Function definition question

Hi all, I am a first time poster, long time Flash user, who is trying to wrap his head around AS3.
When writing functions, I am unclear on on the part that goes inside the parentheses.  For instance, I have see some functions that say:
function XXXXXXX (event:MouseEvent) {
and then some that say:
function XXXXXXX (e:TimerEvent) {
and I think even some that say:
function XXXXXXX (somethingElse:something) {
I get the parts that go after the colon, it is the part before the colon that confuses me.  There seems to be many different posiblities that go before the colon.
How do you know which one, which syntax to use when coding?
By chance they aren't all interchangeable are they?
If not, is there a list that works with the "event:", a different list that works with "e:", etc?
Thanks in advance

what goes before the colon is the variable name.  This is what you use inside the function to refer to the (in this instance) event that is passed in.  This is completely changeable - you could make it gobbledygook:MouseEvent if you wanted to.  Typically best practices state that you should name variables based on their content, so that is why you see event:VideoEvent frequently, and often the shortened version e:VideoEvent.
And, for a little more explanation.
These event parameters (e:MouseEvent) are what is passed when the function is fired from an event listener. (someButton.addEventListener(MouseEvent.CLICK,doClick);)
You don't need to put anything inside of the parentheses if nothing is getting passed into the function.  For example:
function doSomething():void {
trace("something");
This function doesn't need anything in the parentheses, because nothing is getting passed in.  It would be called by a simple doSomething(); in the code.

Similar Messages

  • How to "end" function definition in SQL plus?

    I am using Oracle 11g and SQL plus.
    I am trying to define a function and get back to the SQL prompt, but it is just not exiting the function definition.
    SQL> create function dept_count (dept_name varchar(20))
    2 returns integer
    3 begin
    4 declare d_count integer;
    5 select count (* ) into d_count
    6 from instructor
    7 where instructor.dept_name = dept_name
    8 return d_count;
    9 end
    10 ;
    11
    12
    13
    14
    15
    16 ;;;
    17 end dept_count;
    18 ;
    19
    20 ; <--- I was expecting the SQL> prompt here but it doesn't appear.
    What should I do? Please help. Thanks.

    And, to answer probably the most frequently asked question when I was an Oracle instructor ...
    If you are saving this statement in a file to execute later, after the "/" at the bottom, hit return, so that your file contains a line feed after the /, rather than your file ending with the /
    Otherwise you get the annoying, but completely harmless, error message "Input truncated after (number) characters" when you compile the program.

  • Error message: 1021: Duplicate function definition.

    Hi All,
    First let me start by saying that I know next to nothing about Flash.  I have inherited a website maintenance project that has a Flash rotating image banner.  I have managed to get the images to fade-in and fade-out correctly, but now I need to make these images clickable - linking images to pages in the website.  I have read many posts here and have reviewed the video tutorials.  I have been able to get the first image clickable using this AS3 action:
    mars_btn.addEventListener(MouseEvent.CLICK, buttonClickHandler);
    function buttonClickHandler(event:MouseEvent) :void {
            navigateToURL(new URLRequest("http://somewebsite/mars.php"));
            trace("I'm clicked");
    However, when I attempt to make another image clickable by using a different instance of a button I get the error message:
    1021: Duplicate function definition.
    I have a separate instance of a button with this AS3 action:
    jupiter_btn.addEventListener(MouseEvent.CLICK, buttonClickHandler);
    function buttonClickHandler(event:MouseEvent) :void {
            navigateToURL(new URLRequest("http://somewebsite/jupiter.php"));
            trace("I'm clicked");
    Obviously I'm not understanding how I'm supposed to do this so that I don't create a duplicate function definition.  Any help would be most appreciated.

    excuse me , I have a question i hope that you help .. ( im new in here )
    we were asked to create an interactive application on flash in two languages..
    so i created two different fla files same exact codings ... i was wondering how can i combine them so the viewer can be able to choose the language from a button ?
    when i try to combine them i get lots of errors of duplications in the actionscript
    PS : MY MAIN PAGE INCLUDES A CAROUSEL with images ..
    I was thinking of saving one of the fla  as a movie and then add it some how to the second fla and combine it with a button but i can't figure it how..
    i hope i was clear enough.. but is there any possibility to help me please ?!
    when i tend to change names or something it creates error.. ( IM NOT A PRO IN AS3 ) and when i dublicate the scenes it give duplication errors.. WHAT IS THE SOLUTION ??
    this is the code of the actionscript in the main page.. ( the carousel's code i took from someone ) and i used it on my project
    import com.ccanvas.carousel.*;
    var centerX:Number = stage.stageWidth/4;
    var centerY:Number = stage.stageHeight/4;
    var carc:Carousel = new Carousel(centerX, centerY, 256, 75, "icons.xml");
    carc.addTooltip(new tooltip); // use 'tooltip' movieclip for item tooltip
    addChild(carc); // add carousel to stage
    function down(event:MouseEvent):void {
    trace(event.currentTarget.toolText); // simple click interaction
    function destroyCarousel(event:MouseEvent):void {
    carc.destroy(); // remove all item in carousel as well as tooltip
    function removeNextItem(event:MouseEvent):void {
    if(carc.numOfItems > 2) {
      carc.removeItem(2); // remove the item next to the remove item icon
    create.addEventListener("mouseDown", createCarousel);
    function createCarousel(event:MouseEvent):void {
    if(carc.CREATED == false) {
      // recreate the carousel
      carc = new Carousel(centerX, centerY, 256, 75, "icons.xml");
      carc.addTooltip(new tooltip);
      addChild(carc);
    }/* Click to Go to Scene and Play
    Clicking on the specified symbol instance plays the movie from the specified scene and frame.
    Instructions:
    1. Replace "Scene 3" with the name of the scene you would like play.
    2. Replace 1 with the frame number you would like the movie to play from in the specified scene.
    Tools_button.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene);
    function fl_ClickToGoToScene(event:MouseEvent):void
    MovieClip(this.root).gotoAndPlay(1, "Toolse");
    }/* Click to Go to Scene and Play
    Clicking on the specified symbol instance plays the movie from the specified scene and frame.
    Instructions:
    1. Replace "Scene 3" with the name of the scene you would like play.
    2. Replace 1 with the frame number you would like the movie to play from in the specified scene.
    games_button.addEventListener(MouseEvent.CLICK, fl_ClickToGoToGames);
    function fl_ClickToGoToGames(event:MouseEvent):void
    MovieClip(this.root).gotoAndPlay(1, "Gamese");
    }/* Click to Go to Scene and Play
    Clicking on the specified symbol instance plays the movie from the specified scene and frame.
    Instructions:
    1. Replace "Scene 3" with the name of the scene you would like play.
    2. Replace 1 with the frame number you would like the movie to play from in the specified scene.
    Identity_button.addEventListener(MouseEvent.CLICK, fl_ClickToGoToIdentity);
    function fl_ClickToGoToIdentity(event:MouseEvent):void
    MovieClip(this.root).gotoAndPlay(1, "Identitye");
    }/* Click to Go to Scene and Play
    Clicking on the specified symbol instance plays the movie from the specified scene and frame.
    Instructions:
    1. Replace "Scene 3" with the name of the scene you would like play.
    2. Replace 1 with the frame number you would like the movie to play from in the specified scene.
    Reviews_button.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_13);
    function fl_ClickToGoToScene_13(event:MouseEvent):void
    MovieClip(this.root).gotoAndPlay(1, "Reviewse");
    }/* Click to Go to Scene and Play
    Clicking on the specified symbol instance plays the movie from the specified scene and frame.
    Instructions:
    1. Replace "Scene 3" with the name of the scene you would like play.
    2. Replace 1 with the frame number you would like the movie to play from in the specified scene.
    Facts_button.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_20);
    function fl_ClickToGoToScene_20(event:MouseEvent):void
    MovieClip(this.root).gotoAndPlay(1, "Factse");

  • Has Explorer "Favorites" subtly changed functional definition between V7.0 and V8.1?

    In V7.0 my directory is one of the Directories in 'Favorites' because I put it there, I can't do the same for 'Favorites' in 8.1 Explorer it'll be pointed out that 'Favorites' is a member of my Explorer directory. Favorites in Explorer seems to
    have changed it's functional definition from "these are your favorites" to "this is your favorites  subdirectory".  Wtf?
    Renee
    "MODERN PROGRAMMING is deficient in elementary ways BECAUSE of problems INTRODUCED by MODERN PROGRAMMING." Me

    Hi,
    Did you mean the "Favorites" is the picture below?
    This "Favorites" just like a Windows library, it's used to stored folder shotcuts. The convient for user to access each folder. I also made a test on Windows 7, but didn't find any change with this folder.
    If I misunderstand your question, please feel free let us know.
    Roger Lu
    TechNet Community Support

  • How to make input parameters as optional in the function definition

    I have created a function for a data service which is at the Normalized layer and has 3 input parameters.
    This function is called at the Integration layer in which we have to pass only one parameter. But for the remaning 2 parameters it is throwing an error as we cannot pass those parameters.
    Is it possible that we can pass less number of parameters in the higher layer.
    I had also made those parameters as optional in the function definition(by applying '?' while defining the arguments-e.g. $x as xs:string?), but error was thrown while generating the query plan.
    I have attached a Demo project, in which i have defined a function at the normalized layer and this function is been called at the integration layer.
    Thanks,
    Kinjal

    Thanks mreiche for the reply
    But the problem is that while writing
    function myfunction( arg1 as xs:string, $arg2 as xs:string?) { ... }
    in function definition in the normalized layer, the query plan is throwing following error:-
    com.bea.ld.QueryException: Cannot generate XQuery for the function {ld:DemoProject/Normalized/TestGeo}getGeo:3
    at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108) at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:290)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:248) at com.bea.ld.Server_ydm4ie_EOImpl_816_WLStub.executeFunction(Unknown Source)     at workshop.liquiddata.xds.views.queryplan.QueryPlanPanel.compileFunction(QueryPlanPanel.java:583) at workshop.liquiddata.xds.views.queryplan.QueryPlanPanel.access$900(QueryPlanPanel.java:39) at workshop.liquiddata.xds.views.queryplan.QueryPlanPanel$5.run(QueryPlanPanel.java:469) at java.lang.Thread.run(Thread.java:534)
    Caused by: com.bea.ld.QueryException: Cannot generate XQuery for the function {ld:DemoProject/Normalized/TestGeo}getGeo:3 at com.bea.ld.EJBRequestHandler.invokeFunction(EJBRequestHandler.java:720) at com.bea.ld.EJBRequestHandler.executeFunction(EJBRequestHandler.java:339) at com.bea.ld.ServerBean.executeFunction(ServerBean.java:95) at com.bea.ld.Server_ydm4ie_EOImpl.executeFunction(Server_ydm4ie_EOImpl.java:312)
    at com.bea.ld.Server_ydm4ie_EOImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:491)
    at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:120)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:434)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:429)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:35)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
    Caused by: com.bea.ld.server.FunctionCallQueryBuilder$QueryBuilderException: The following parameter type is not supported: {http://www.w3.org/2001/XMLSchema}string?
    at com.bea.ld.server.FunctionCallQueryBuilder.addParameter(FunctionCallQueryBuilder.java:257)
    at com.bea.ld.server.FunctionCallQueryBuilder.buildQuery(FunctionCallQueryBuilder.java:99)
    at com.bea.ld.EJBRequestHandler.invokeFunction(EJBRequestHandler.java:716)
    But no error is thrown when I call this function at the Integration layer,using
    for $f in mfunction( 'test', () )
    and the output which i get is as expected.

  • CRM FUNCTIONAL interview questions and answers

    Dear Friends,
    Good Afternoon..!!!
    can you tell me the CRM FUNCTIONAL interview questions with answers if avialable.....
    Regards,
    Dhananjaya

    Dear friends,
    Can any body forward me interview questions and answers
    can any body tell me where can i get crm functional video tuter

  • Travel Management functions interview question and answers

    Hi Guys,
    I wanted to know Travel Management functions interview question and answers , it is most urgent for me.
    Your detail response will be highly appreciated.
    Thanks – Sam.

    Check this site
    http://help.sap.com/saphelp_470/helpdata/en/73/6bf037f1d6b302e10000009b38f889/frameset.htm
    Regards,
    Ruben

  • Oracle Asset (Functional) Practice Questions for Interviews and Exam

    https://www.createspace.com/3495382
    http://www.amazon.com/Functional-Questions-Interviews-Certification-Examination/dp/1456311581/ref=sr_1_4?ie=UTF8&s=books&qid=1289178586&sr=8-4
    List Price: $29.99
    Add to Cart
    Oracle Asset (Functional) Practice Questions for Interviews and Certification Examination (Release 11i and 12)
    Functional Consultant
    Authored by Erp Gold
    This book contains 150 Oracle Asset Practice Questions for functional consultants. Very useful for interviews and certification examinations.
    Publication Date:
    Oct 26 2010
    ISBN/EAN13:
    1456311581 / 9781456311582
    Page Count:
    94
    Binding Type:
    US Trade Paper
    Trim Size:
    6" x 9"
    Language:
    English
    Color:
    Black and White
    Related Categories:
    Computers / General

    Reported as spam!

  • Oracle Asset (Functional) Practice Questions for Interviews and Certificati

    https://www.createspace.com/3495382
    List Price: $29.99
    Add to Cart
    Oracle Asset (Functional) Practice Questions for Interviews and Certification Examination (Release 11i and 12)
    Functional Consultant
    Authored by Erp Gold
    This book contains 150 Oracle Asset Practice Questions for functional consultants. Very useful for interviews and certification examinations.
    Publication Date:
    Oct 26 2010
    ISBN/EAN13:
    1456311581 / 9781456311582
    Page Count:
    94
    Binding Type:
    US Trade Paper
    Trim Size:
    6" x 9"
    Language:
    English
    Color:
    Black and White
    Related Categories:
    Computers / General

    Reported as spam!

  • Duplicate function definition error on buttons

    Hi there!
    Ok first I'm a complete beginner when it comes to Flash so please bare with me.
    What I'm looking to do is create a banner that transitions between different photos while there are small square buttons on the side that when the user clicks on them, it jumps to the corrosponding frame where a new photo begins showing. I've seen it a bunch of times on other websites.
    After following the advice found here: http://forums.adobe.com/thread/781826?tstart=0
    Everything was going well until I hit a snag. When trying to preview my movie I got the following error:
    1021: Duplicate function definition
    Now, I know there is a very obvious error here in my button scripts, but as I said, I have no idea what I'm doing. Can someone look at my code and tell me what's wrong and what I should change? I'll post all five scripts.
    The instance names by the way are "sidebutton1" thru "sidebutton5" if that's any help.
    Here's my codes for each of the five buttons (one of these code bits per button):
    sidebutton1.addEventListener(MouseEvent.CLICK,f);
    function f(e:Event):void{
    gotoAndPlay(1);
    sidebutton2.addEventListener(MouseEvent.CLICK,f);
    function f(e:Event):void{
    gotoAndPlay(100);
    sidebutton3.addEventListener(MouseEvent.CLICK,f);
    function f(e:Event):void{
    gotoAndPlay(200);
    sidebutton4.addEventListener(MouseEvent.CLICK,f);
    function f(e:Event):void{
    gotoAndPlay(300);
    sidebutton5.addEventListener(MouseEvent.CLICK,f);
    function f(e:Event):void{
    gotoAndPlay(500);

    sidebutton2.addEventListener(MouseEvent.CLICK,f2);
    function f2(e:Event):void{
    gotoAndPlay(100);
    sidebutton3.addEventListener(MouseEvent.CLICK,f3);
    function f3(e:Event):void{
    gotoAndPlay(200);
    Each function must have a special name...

  • Error 1050, when calling MATLAB 7.1 from LV8.0 - Function Definitions not allowed.

    I am trying to call a MATLAB M-file from LabVIEW 8.0. I keep getting Error Code 1050:
    "Error 1050 occurred at LabVIEW:  Error occurred while executing script. Error message from server: ??? Error: Function definitions are not permitted at the prompt or in scripts.
    . in rickfito.vi->impedo.vi
    Possible reason(s):
    LabVIEW:  Error occurred while executing script"
    I tried running the sample MATLAB script example on the knowledge base, and everything works fine.
    I am guessing that this error is happening because I have functions defined in the MATLAB script. But i thought this is better programming techinque. Also, the MATLAB window opens up when I start the VI.
    Is there a way around this? I really do not want to remove the function definitions on the script.
    Thx,
    Pelo...

    First, see if the Matlab Script Node is trying to open any files. If
    so, then make sure that the current Matlab directory is set to the
    directory where that file is located. The Matlab script node in LabVIEW
    does call the Matlab script server and executes the function in the
    Matlab script node through Matlab. Therefore, even though LabVIEW may
    be in the correct directory where the file is located, make sure Matlab
    is as well.
    The error may also occur if there is a disruption
    in the script server between MATLAB and LabVIEW and the connection was
    never re-established (possibly by closing MATLAB prematurely). Close
    both LabVIEW and MATLAB then relaunch them both and run the VI.
    MATLAB®
    is a registered trademark of The MathWorks, Inc. Other product and
    company names listed are trademarks and trade names of their respective
    companies.
    -Bob
    -Bob

  • 1021: Duplicate function definition I am lost... please advise

    I am obviously new to as3... So I have 3 buttons (all in the same scene) that each need to go to a different scene. I put the script's on the same frame. Here is the script's:
    btn_pg.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);function mouseDownHandler(event:MouseEvent):void {
    gotoAndStop(1, "photo_gallery");
    btn_vg.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);function mouseDownHandler(event:MouseEvent):void {
    gotoAndStop(1, "photo_gallery");
    This is the error message it gives me:
    home_1, Layer 'actions', Frame 1, Line 8 1021: Duplicate function definition.
    What do you have to do to use the same function for different buttons to get to different scenes?
    Thank you for any consideration and help,
    Thomas

    I tried to ad another button to that same code and it does not give an error but when i publish it doesn't do anything...
    This is the code after I added:
    btn_pg.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    btn_vg.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    function mouseDownHandler(event:MouseEvent):void
    var nameOfButton:String = event.currentTarget.name;
    if (nameOfButton == "btn_pg")
      gotoAndStop(1, "photo_gallery");
    else if (nameOfButton=="btn_vg")
      gotoAndStop(1, "video_gallery");
    else if (nameOfButton=="btn_b")
      gotoAndStop(1, "blog");
    Can you not have an infinite amount of buttons with this code?
    Thanks again
    Thomas

  • Where are the niScope function definition​s (e.g. niScope_Au​toSetup())​?

    I am just learning niScope, and I am having trouble
    locating simple function definitions (e.g. niScope_AutoSetup()).
    I don't mean just the .h header files, I need
    something that tells me what these functions
    actually do.
    Anyone know a good ref for this?
    Pete

    If you are using Measurement Studio, you can download and use the Measurement Studio C++ interface for NI-Scope. You can download it from
    http://zone.ni.com/devzone/conceptd.nsf/webmain/57​1407DDD78BB81986256B9F0047241E?OpenDocument
    This interface provides C++ classes that use the Measurement Studio data types, such as CNiException and CNiReal64Vector. There also is a help file that plugs directly into the Measurement Studio help file for convenient class and function reference.

  • [svn:fx-trunk] 11894: Fix ASC-3586 ( NPE analyzing function definition in dead code)

    Revision: 11894
    Revision: 11894
    Author:   [email protected]
    Date:     2009-11-17 07:58:11 -0800 (Tue, 17 Nov 2009)
    Log Message:
    Fix ASC-3586 (NPE analyzing function definition in dead code)
    Original patch author: Jeff Dyer
    Reviewer: Tom Harwood
    Tests: asc/tamarin/flex acceptance tests
    Ticket Links:
        http://bugs.adobe.com/jira/browse/ASC-3586
    Modified Paths:
        flex/sdk/trunk/modules/asc/src/java/macromedia/asc/semantics/ConstantEvaluator.java

  • Forum Search Function - A Question

    I know that the Adobe Forum team has worked hard over the last year, to improve the forums' Search Function. The standardization across the various forums, the utility of Search, HAS been improved - thank you for that work.
    However, once, after one ran a Search, and received a results page, it was possible to go thread-by-thread in those results, to pick the one, ones, that worked for an OP's situation, and by just using the browser's Back button, the searcher was taken back to the Search results page, for more research. Now, the Back button takes me (Chrome on Windows PC) to the general Discussions page, and not the Search results page. This means that the Search criteria have to be re-added. At first, it would seem that Copy/Paste for the Search criteria would be the best workflow, and just re-do that Search, over and over, reading one thread per Search. However, I use Search most often to help posters get answers, and I use the URL to the existing threads to do that. Here is an example of how I use Search, and how it works for me now - the current Search:
    Poster has a question, and many other threads in a forum answer that/those question(s). I find six existing threads, that match my Search criteria. Good so far. I then need to read all six threads, to find the one(s), that are best for the new poster. When I find one, I Copy the URL of that thread, and add that to my Reply to that poster. I cannot Copy the Search criteria, to use in the Search query box, as I just Copied the URL to one thread in the list. I then have to go back to the main Discussions page, and re-initiate my Search, to read the second of the six threads - rather tedious, especially with more than one useful thread.
    My workaround now, is to create a NotePad document with my Search criteria, and go back to it, Copying and Pasting those characters, after doing a Copy/Paste of a threads URL. Still tedious, but less typing.
    Not sure if the old method, or using Back to get to the Search results page, could be re-implemented, leaving the rest of the Search functions untouched, or if someone knows a neat way to return to the Search results page, that I just am not aware of (do not mind admitting OE on my part, and am open to perhaps a better workflow, for how I normally use Search).
    Hunt

    Jacob, unfortunately and although true, that doesn't agree with the image "normal" users get, with those unnecessarily brightly colored badges, and even more unnecessary special backgrounds in their posts, no matter how trivial (and I am not in the least questioning their most legitimate right to post trivial messages)... Their word doesn't become the Bible by the mere fact of being punished with their MVP titles, as the highlighting of their posts seems to suggest.
    And yes, I know that -at least- many of you haven't chosen to be nominated as MVPs but, what does the general public think? Most probably, that you all have full moderating powers, and some other powers as well. A sad, artificial, and most unneeded situation -most definitely not an improvement.

Maybe you are looking for