passing parameters to functions triggered event

Hi all
I created a button and added EventListener.
as mybutton.addEventListener (MouseEvent.CLICK, clickSt);
When I apply the clickStart function (event: MouseEvent) I'd like to
an array, a string to the function as parameters. How can I do this.
is it possible or not.
thanx.

Well, not this way.
The function automatically receives a parameter when you create a reminder with this 'addEventListener' function, this parameter is datatyped as the event type that you defined in the callback, in your case "MouseEvent". If you want to pass more data when the function is called so you have create your own event class because almost all of the events just inform when something happened and send limited information. You can consult the documentation on creating a custom event class, there is a lot of info on the subject.

Tags: Flex

Similar Questions

  • Passing parameters through types of event listeners

    Especially my question is, is - it possible to pass parameters through e.g. a MouseEvent.CLICK, or Event.ENTER_FRAME, if so how?

    You can use:

    a.addEventListener (MouseEvent.CLICK, function(e:Event) {f(e,p1) ;});
    b.addEventListener (MouseEvent.CLICK, function(e:Event) {f(e,p2) ;});
    c.addEventListener (MouseEvent.CLICK, function(e:Event) {f(e,p3) ;});

    function f(e:Event,p:*):void {}
    }

  • How to pass parameters to the answering machine functions?

    Hi guys,.


    IM using AMFPHP and I would like to spend a few paramteres to answering function, how can I do this?

    new answering machine ('success', 'fault'); I would like to pass a few simple parameters to function of success.

    Saludos

    Marcin

    try now, you can provide the type of event argument in function (event)

    new Responder (function (event): void {actualFunction (evnet, yourParam)}; 'fault');

  • Pass parameters with a function that is a parameter to another function.  Is this possible?

    Hello

    I have some difficulty to pass parameters to a function that is passed as a parameter.  In the code for my application I am instantiating this class five times: they are buttons in a menu.  In this category, I had an onRelease handler that does a number of things when a button is released, which is to call a function defined in the level of enforcement of the code.  My problem is that I don't know how to send parameters to the functions.

    In my StandardButton class I:

    class StandardButton extends MovieClip
    {
         
         /* define properties */
         private var selected:Boolean = false;
         public  var btnMenu:MovieClip = null;
         public  var execFunc:Function;
         
         /* define constructor */
         public function StandardButton()
         {
              trace("Standard UI button created: " + this);
              this.onRelease = releaseHandler;
         }
         
         /* define methods */
         public function releaseHandler()
         {
              if (selected) {
                   
                   //this["bg"].gotoAndStop("normal");
                   //selected = false;
                   
              } else {
                   
                   //show the normal state of all other buttons in the menu set
                   for (var i:Number = 0; i < btnMenu.btnList.length; i++)
                   {
                        this._parent[btnMenu.btnList[i]].bg.gotoAndStop("normal");
                        this._parent[btnMenu.btnList[i]].selected = false;
                   }
                   
                   //show the select state of the button
                   this["bg"].gotoAndStop("select");
                   
                   //execute the function attached to this button
                   execFunc();
                   
                   //set the selected boolean for the current button
                   selected = true;
                   
              }
         }
         
         
         /* define accessors */
         public function set execFunction(instructions:Function)
         {
              execFunc = instructions;
         }
         
         public function set buttonMenu(menu:MovieClip)
         {
              btnMenu = menu;
         }
         
    }
    

    In my application .fla file, I have this

    //This is the function that will be executed when the user presses the button
    function autoModeHandler (param:String) {
         
              trace("You pressed the " + param + " button");
              
                                  
    }
    
    init();
    
    masterContainer.menuContainer.Auto.execFunction = Delegate.create(this, autoModeHandler);
    

    The function is successfully "sent" to the class of StandardButton, but without any parameters.  How can I send parameters for the instance of the class with the way I had it built.  Any help is greatly appreciated!

    Thank you for your time and help!

    You can pass parameters as you're passing that work.  you just need an instance of StandardBtn.

  • Passing parameters using ADR - 404 error

    Hi all

    I'm all new development APEX. We use the DEPT tables in the sample application oracle provided for practice.

    We currently use ADR to pass parameters, but it does not work as expected, or at all. We receive a 404 when you try to run the page.

    Objective: User enters number of Department for an article and a 'Change' event (or "lose focus", we have not yet decided) on a dynamic action fills the name field with the name of the service dept.

    Has anyone else got this error?

    If there is another method recommended, please let me know.

    Thanks for your time.

    Thanks for the answers, but we have understood the question.

    We have changed the JavaScript code as follows:

    $.getJSON ("https://apex.oracle.com/pls/apex/mfajertest1/department/"+ $x value ('P2_DEPT_NO'), function (json))

    {

    Console.log (JSON);

    $x('P2_DEPT_NAME').readOnly = false;

    $x('P2_DEPT_NAME').value = json.items [0] .dname;

    $x('P2_DEPT_NAME').readOnly = true;

    $x('P2_DEPT_LOC').readOnly = false;

    $x('P2_DEPT_LOC').value = json.items [0] .loc;

    $x('P2_DEPT_LOC').readOnly = true;

    });

    Thanks for the effort.

  • How to pass parameters using dispatchEvent.

    Hello

    I wrote a class imageLoader. I want to send an event to the end of the loading image in the document class where imageLoader has been initialized.

    public void onLoaderProgress(e:ProgressEvent) {}

    imgLoader.removeEventListener (ProgressEvent.PROGRESS, onLoaderProgress);

    trace (e.bytesLoaded, e.bytesTotal);

    }

    public void onLoaderComplete(e:Event) {}

    imgLoader.removeEventListener (Event.COMPLETE, onLoaderComplete);

    dispatchEvent (new event ("loaded Image"));

    imgContainer.addChild (imgLoader);

    }

    onLoaderComplete is the image of load complete event and onLoaderProgress is the image of loading progress event. Here, I sent an event in the inLoaderComplete event. I want to send parameters with the dispatchEvent. How can we do?

    Kind regards

    Sreelash

    You can use the CustomeEvent class below to have attached to your dispatchEvent function parameters...

    package

    {

    import flash.events.Event;

    SerializableAttribute public class CustomEvent extends Event

    {

    public var params: Object;

    public void CustomEvent (type: String, params: Object, bubbles: Boolean = false, cancelable: Boolean = false)

    {

    Super (type, bubbles, cancelable);

    This.params = params;

    }

    Public Overrides function clone (): event

    {

    return new CustomEvent (type, params, bubbles, cancelable);

    }

    Public Overrides function toString (): String

    {

    Return formatToString ("CustomEvent", "params", "type", "bubbles", "cancelable", "eventPhase");

    }

    }

    }

    To send the event you just use something like the following, where the parameters are specified as an object...

    dispatchEvent (new CustomEvent ("ImageLoaded", {param1: someValue, otherParam: otherValue}, true));

    At the end of reception in the ImageLoaded handler, you can acquire the parameters to help...

    evt.params.param1

    evt.params.otherParam

    where 'evt' is replaced by any name you assign to the argument passed to the event handler function

  • Is it possible to pass parameters through eventlisteners?

    Hi all!

    Inside of a .fla file I have a few buttons, and each button will be tween a different image to the scene. All images are off the stage in the same x and position there and I just need to interpolate the coordinate x.

    Now, I am working with a document class external where I'm holding all my features and I'm stuck with interpolations. I'm willing to stay away from the tween flash engine and I'm working with tweenLite.

    My question is: is it possible to pass parameters through eventListeners so I can use something like this inside my docClass?

         public function animeThis (e:MouseEvent, mc:MovieClip, ep:int):void { //ep stands for endPoint.
         TweenLite.to(mc, 2, {x:ep});
         }
    

    If possible, how can I write the listeners if it's going to pass the event to be listened to AND these settings? And how to build the function so it will receive these settings and the event?

    If this is not possible, what is the best approach to do this?

    Thanks again!

    Hey Rafael,.

    Oh, it's too overwhelming to use a function to pass parameters to another function?

    It's completely legitimate way of dealing with things. Your original question was about passing additional params with the events - that's why I responded with the example of the custom event.

    Much depends on the needs of the application and architecture.

  • newbie on passing variables between functions

    Hi, I'm new to flash development and did only Java, C++, assembler before. This issue will be probably fairly simplistic. I want to click on a button, which will then call on another method, pass it several integers (ints) and the method returns an int after certain operations. Here is a snippet of my code.

    package
    {
        import flash.display.Sprite;
        import flash.events.MouseEvent;
        import flash.media.Sound;
        import flash.text.TextField;
        import flash.text.TextFormat;
    
        import mx.controls.Text;
    
        import qnx.ui.buttons.Button;
        import qnx.ui.buttons.LabelButton;
        import qnx.ui.text.TextInput;
    
        import spark.components.TextArea;
    
        // The following metadata specifies the size and properties of the canvas that
        // this application should occupy on the BlackBerry PlayBook screen.
        [SWF(width="1024", height="600", backgroundColor="#cccccc", frameRate="30")]
        public class AIRHelloWorld extends Sprite
        {
            public function AIRHelloWorld()
            {
                //var R1 R2 and R3 are declared and read from here. 
    
    //here is where the call should happen
    //calculation button
                var total:Button = new Button();
                total.addEventListener(MouseEvent.CLICK, calculate, R1, R2, R3); //this should return an int
    
                //textformat for the calculate button
                var Calformat:TextFormat = new TextFormat();
                Calformat.color = 0xAA0000;
                Calformat.color = 0xAA0000;
                Calformat.size = 24;
                Calformat.italic = true;
                Calformat.align = "center";
    
                //text for the button
                var text:TextField = new TextField();
                text.text = "Calculate";
                text.setTextFormat(Calformat);
    
                //add text to calculation button
                total.addChild(text);
    
                stage.nativeWindow.visible = true;
            }
    
            private function calculate(event:MouseEvent, R1:int, R2:int, R3:int):int {
                return 0;
            }
    
            private function closeWindow(event:MouseEvent):void{
    
                stage.nativeWindow.close();
            }
    
            private function goToBackWindow(event:MouseEvent):void {
                stage.nativeWindow.orderToBack();
    
            }
        }
    }
    

    Needless to say, Adobe Flash builder don't like what I'm trying to do. Apparently EventListener does that take Boolean arguments. So how the values of R1 R2 and R3 to the function calculate?

    Thank you for your time

    Hello and welcome:

    In Flash/Flex/AIR event model is very simple and flexible.  In your example, it is better to create a LabelButton and add the event listener to that (fewer lines of code).  As:

    var button: LabelButton = new LabelButton();

    Button.label = "Push Me";

    button.addEventListener (MouseEvent.CLICK, DoCalculate);

    If necessary, adjust the location

    addChild (button);

    When the mouse is clicked, a "MouseEvent" event is sent to the DoCalculatefunction.  All event listeners must accept a parameter of an event. All events derive from the class of events 'event '.  Thus, the type of parameter can either be a MouseEvent from that which was given to generate, or the most high quality event.

    private function DoCalculate (event: Event): void

    {

    do something

    }

    Now what needs to be calculated would be information in the same point of view or accessible to the DoCalculate method.  So if you have 3 domains (e.g., TextInput), then those would be deprived of the main view and then attributes can be used to determine the result of the mouse click.  For example:

    SerializableAttribute public class MyApp extends Sprite

    {

    private var r1: TextInput = new TextInput();

    private var r2: TextInput = new TextInput();

    private var r3: TextInput = new TextInput();

    public void MyApp()

    {

    Add text entry to display a list

    make the application visible

    create a button

    Add button click listener

    }

    private function DoCalculate (event: Event): void

    {

    var sum: int = parseInt (this.r1.text) + parseInt (this.r2.text) + parseInt (this.r3.text);

    do something with sum

    }

    }

    Hope that helps.

  • pass parameters to the pop-up window using skillbuilder

    All,

    I have a request of dynamic content on page 1 and for some lines ive the pop-up link another page and pass the EMPID clicked on page popupped. Ive created the link and its popping up the second page correctly, but how I have the pass of the EMPID per second / page popup?
    part of query in page1 like this,
    htp.p('<td><a href="#" class="show-summary" onclick="return false;">'||cursor-id.EMPID||'< . . . . . 
    Thank you.

    Gor_Mahia wrote:
    Jorge,

    IAM but perhaps not very clear what you did ive tried it before, but it losses the modal pop-up window and navigate to this page, I really try to have my modal popup window. Look at my request below,

    You just described a completely different problem from that of passing parameters modal page.
    Just add a more real Action "Cancel the event" after the action of modal Page.
    What that will do is replace the click of the anchor who want to access the link HREF.

    Thank you
    -Jorge

  • Pass parameters in a DPS application

    I have an app from the DPS with 2 slots. A slot contains a built-in code that is supposed to show a list of goods. A slot contains code that launches an external site in a frame within the DPS app.

    In accordance with article API Marketing consumer news | Adobe Developer Connection, it is possible to pass parameters to an external application to a DPS application.

    I'm running a problem. In my external site, I try to call the DPS application like so dpsapp://v1/slot/storefront?path=/content/test.pdf via a button.  What I noticed is that when I do that, the soft switches on the side window but urlPath queryingthe or urlQueryString returns a null value.

    It seems that I can't pass a parameter to the DPS app within a single application. If I load the external website in Safari, I'm able to query for the parameters.

    Am I missing a step here or isn't it possible?

    Thank you

    You need manage paths... the first is when the application has failed.  In this case, just use the code in the previous post ('companyName' change 'path').  However, if the application worked, but it is backgrounded, so you must have annexed a listener for the event event.

    That is to say. adobeDPS.configurationService.applicationContextUpdatedSignal.add (this.updateContext, this);

    And then your method "updateContext" navigate the urlQueryString as previously indicated.

    Additionally, make sure that you have included "showcase" in the "name of the Goto link" when you set your custom button.

  • Faced with HTML5 - only may not even pass parameters to the script .jsx

    I am really struggling to get acquainted with HTML5 and the conversion of my existing extension.  A general request first - what are the best resources to help a general grounding in HTML5?

    Now a specific question.  In the default example functions in the .jsx are all processed in $._ext_.  What is the purpose of this?  How do you pass a parameter in a function that is defined like this.  Now, I'm trying just to pop up an alert with a parameter passed.  I tried many things, but here I am:

    In my index.html file, I have a button:

    < li > < button class = "default" id = "btn_LoadPresets3" onClick = "wizClickButton('10')" > myFunction < / button > < /li >

    In the ext.js script, I have a function which gets this:

    function wizClickButton (inParam) {}

    Alert ("press me" + inParam);

    var csInterface = new CSInterface();

    csInterface.evalScript ('myFunction2()');

    }

    In my script .jsx, I have the following function:

    function myFunction2()

    {

    Alert ("Yo");

    };

    Now - when I run this and press the button, the first alert box shows and shows me my parameter ("press me 10" in this case).  But that's all - so the function in my script .jsx never gets called.  I don't know why.  So - I look at the example functions and they are all preceded with the $._ext - I change the function in my script .jsx for:

    $._ext_myFunction2 =

    {run: function() {}}

    Alert ("Yo");

    }

    };

    and modify the ext.js call to call the same

    function wizClickButton (inParam) {}

    Alert ("press me" + inParam);

    var csInterface = new CSInterface();

    csInterface.evalScript (' $. _ext_myFunction2.run () ');

    }

    So now, when I run it I get the second alert box.  Everything is good.  Only how I pass my parameter down in the script .jsx?  Where the parameter is both the definition of the function and the call to the function?  That brings the ._ext_ $ to the party?  Why not my definition of the standard function without the ._ext_ $?

    Many thanks in advance,

    Richard

    Hi Richard,

    I first suggest you use reusable code David Deraedt (and not Extension Builder, which treats the $. useless _ tips): davidderaedt/CC-EXT-SDK · GitHub. I don't know why you get the error: I don't use $._ext_ me so it shouldn't be a requirement.

    You can find a few first aid signs in my HTML signs quick tips. You will also find the way to pass parameters of JS-> JSX (as simple or complex objects parameters) and vice versa, JSX-> JS

    HTML: personally I found useful tutorials on www.tutsplus.com (HTML, JS, etc) but I guess there are a lot of free resources out there (the one that comes to mind is a A Practical Guide to HTML & CSS - learn how to build Web sites, Apple made one too Safari Web content Guide: HTML Basics).

    Concerning

    Davide Barranca

    ---

    www.davidebarranca.com

    www.cs-extensions.com

  • Passing parameters to the method call in expressions of value

    JDeveloper 11.1.2.1.0 does support the feature of passing parameters to method calls in expressions of value in JSF pages? AFAIK this is JSF 2 version it and it should support this feature. Unfortunately when I put in a JSF page the following tag
    < h:commandLink value = "#{row.employeeId}" action = "#{empBean.showDetails (row)}" / > "
    The page does not work. Any ideas on this point?

    Thank you to everyone.

    Hello

    The functionality you need is defined in JSR 245.
    If you need to wait for it to become part of the standard, it will be included in JEE6
    I don't know if 11.1.2.1.0 uses JEE6 standard...
    You can try this other thing,
    http://www.coderanch.com/t/213290/JSF/Java/why-JSF-calls-method-parameter

  • Passing parameters in Director. Is this possible? Experience with Multipoint?

    I use Director for a series of educational applications. I have a single projector (start) where students can click on their name. When a name is selected, Startup Spotlight consults a database to determine which educational projector is expected to be launched. Based on the results in the database, I use the call of baRunProgram boyfriend to start the appropriate Director projector. Right now, I use a text file to record the student's progress in their work their way through the educational projector. All this works fine for a single user on a single computer.

    However, I am having a problem with a customer who uses Microsoft Multipoint. Using Multipoint, there are several students running the program to start in the same place. Therefore, the text file progress of all students instead of one student's progress. Startup Spotlight knows what student is active but the individual educational Spotlight do not currently have this information. I could identify a single student to the education projector passing a parameter. First of all, is it possible? If so, how could he do?

    Abstract of the passage of a parameter, is there another method that might work to accomplish the same thing?

    Everyone works in a Multipoint environment? I am interested in other experiences with Multipoint.

    You can pass parameters to a projector on the command line, but only at the launch of it. Check the documentation for "line of command" and also the function of baCommandArgs() of Buddy API

  • Problem with passing parameters to an HTTPService on buttonclick within the grid

    I have a DataGrid where I use ItemRenderers to render components such as buttons n Images within the grid. Now, I need to pass parameters to an HTTPService on click of a button. If the button is directly on the form (not in the grid), is easy to call HTTPService. But given that the button is in a grid, it is not able to resolve the HTTPService and so I can't call the HTTPService on ' click on ' event of the button.

    I would like to know if anyone can help.

    You should probably use click = "outerDocument.myClickHandler ()" "

    The outerDocument allows you to access the methods outside of the rendering engine.

    If this post has answered your question or helped, please mark it as such.

  • Passing parameters to Discoverer

    Hello

    I'm trying to pass parameters in Oracle Discoverer and see references to Metalink notes 282249.1 . Could someone put a link to this info, as I can't find anywhere

    Thank you

    Hello

    It's taken form the Metalink Note 282249.1
    -----------------------------------------------------------------------------------------------------------------------------------------
    Perform the following steps to implement Workaround:

    1. create a function of database as follows:

    / * This function accepts the parameter that is passed during the execution of the workbook * /.
    create or replace function setparam (varchar2 emp_name)
    RETURN NUMBER
    is
    Start

    / * Setting the value of the parameter the client session information so that which can be consulted
    from the folder personal in the admin edition * /.

    DBMS_APPLICATION_INFO.set_client_info (emp_name);

    RETURN 1;
    END;

    2. save this function in discoverer administrator. To register a function, see:
    Oracle® Business Intelligence Discoverer Administration Guide
    "How automatically save the custom PL/SQL functions.

    3. create a workbook via Discoverer Plus or office and put a dummy condition in the workbook as:

    1 = SETPARAM (: {PARAMETER-NAME})

    For example:

    1 = SETPARAM(:Employee Name)

    The function SETPARAM database sets the value of the parameter passed during execution of the workbook as client_info for the session and always returns 1. The value returned by this function is compared with the 1 in the condition added to the workbook. Therefore, condition always returns true. This condition has no effect on the data surveyed by the workbook.

    The function SETPARAM serves just the purpose to save the value of the parameter as client_info then accessible by using the function (USERENV('CLIENT_INFO')) located in the folder of the administrator.

    The SQL in the personal file will be:

    Select * from table (select emp_desc from employees where ename = USERENV ('CLIENT_INFO'))

    Indirectly, this method passes the value for a parameter in the workbook to the State in the custom folder.

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Thank you
    Fati

Maybe you are looking for

  • After you install an update to Adobe Flash, Firefox opens and remains black screen

    Firefox was working perfectly yesterday. When I started this morning, Adobe Flash Player was asked to run an update. I did it. Now, Firefox opens and stays black. I tried a reset safe mode and reinstall full. None worked

  • copy the file to the desktop

    How can I copy a file on the desktop? How to find the path for the desktop users (multi-language)? is there a special variable like %UserProfile%?

  • I want to delete cookies from sites variousTravel.

    Try to book tours and sites to the top of their price whenever I visit. I think they know that I'm looking book, kind of 'Look at me' How do I get rid of their cookies without losing my history/bookmarks and passwords?

  • BlackBerry® Smartphones ISP E-mail

    I have a Pearl 8130 and when installing, I have included my ISP email address.  I get ringtones through email, but I also have a mailbox in good health.  I bought a Blackberry e-mail account and I will now no longer wish to receive email through my c

  • High availability with two 5508 WLAN controllers?

    Hi all We are considerung to implement a new wireless solution based on Cisco WLC 5508 and 1262N Access Points. We intend to buy about 30 access points and have two options: either buy a WLC 5508-50 or, for redundancy to, two controllers 5508-25. Is