Can I call a function using the array index?

I defined a table that stores the name of the function, like this:

var aresetButtonTop:Array = new Array(resetTop1,resetTop2,resetTop3,resetTop4,resetTop5);

Then I have a button named "btnresetTop" which, once clicked will be called one of the five functions stored in the array (aresetButtonTop) above. Functions are called at runtime depending on certain conditions. I need to figure out how I can call these functions using the array index. I use the following code to call the function. The value of i has already been calculated.


btnresetTop.addEventListener (MouseEvent.CLICK, aresetButtonTop [i]);

After doing this, I get the following error when I click on the button:

TypeError: Error #2007: parameter listener must be non-null.
at flash.events::EventDispatcher/addEventListener()
at gallerytest_fla::MainTimeline/thumbTopClick()

Note: thumbTopClick() is a function within which all these codes are written.

I need to know if it is posible in AS3 to call a function name using array index or not. If so, could you afford ehelp me out.

You can certainly do.

In your case, it looks like i is out of range. Show your loop.

Tags: Adobe Animate

Similar Questions

  • How can I call two functions in the HTML Form element attributes

    Hello

    I want the same value in the text field two, when I select the value to select the list then the value with a number increment should be two text field.
    I use both java script

    < script >
    function sumItems() {}
    function getVal (item) {}
    If ($x (point) .value! = "")
    Return parseFloat ($x (item) .value);
    on the other
    return 0;
    }
    $x('P19_LAST_END_YR').value = getVal ('P19_LAST_STR_YR') + 1;
    }
    < /script >


    < script >
    function per1Items() {}
    function getVal (item) {}
    If ($x (point) .value! = "")
    Return parseFloat ($x (item) .value);
    on the other
    return 0;
    }
    $x('P19_LAST_END_YR').value = getVal ('P19_START_YEAR') + 1;
    }
    < /script >


    now how can I call function onchange two attributes of the element in the HTML form for the discount:
    ' onChange = "javascript:sumItems()" onChange ="javascript:per1Items().

    Hello

    Try

    onchange="sumItems();per1Items();"
    

    BR, Jari

  • Can I call a function with the argument % ROWTYPE directly from SQL?

    I have the following function in a 10g DB:

    FUNCTION to CREATE or REPLACE f_is_eligible2 (in_dm_row IN amplify_dm % ROWTYPE)
    RETURN NUMBER
    IS
    ....

    I know that I can call this function to another function from pl/sql, but I wonder if I can call this function directly from an SQL statement, something like this:

    SELECT f_is_eligible2 (dm.*)
    Of amplify_dm dm

    or

    SELECT f_is_eligible2 (dm % rowtype)
    Of amplify_dm dm

    None of those who have worked so I think it is not possible, but I thought I'd ask anyway.

    Thanks in advance!

    You are correct, it is not possible.

    SY.

  • Calling a function in the HTML window that course is located inside - 8 Captivate

    Hello

    I scoured the forums to answer this but still have developed in white.

    Our LMS is launching a course in a pop-up window and inside that the Captivate output file .htm lies.

    Currently this pop-up window has a button that performs a function.  The problem is this button is rather unsightly sitting above the price in the HTML window and I wish I could call this function inside the Captivate course itself.

    The function is called closeSCOContent() and it closes the window of course but basically sends the user to a page of comments.

    So, basically is it possible to call this function using the Javascript function in Captivate 8?

    I hope that I have explained that sufficient

    Thank you very much!

    You should be able to call the function, but you would need to know where he is regarding parents/children/opener. Looks like there's frameset inside the popup.

  • Call a function within the same CFC component

    Hello
    / * Niewbie Question * /.
    I have a strange problem. When I try to call one function on the other in the same CFC component, I get an error named: "Entity has incorrect type to be called as a function."
    I looked on many forums and searched in Google groups. I have yet found a work around for this problem.
    I thought I did caution o not use twice the same name...
    Can someone tell me what I did wrong?

    My sample code to reproduce this error is included

    The full error message is:
    Entity is of the wrong type to be called as a function.
    The symbol you provided superfunction is not the name of a function.

    The error occurred in C:\ColdFusion8\wwwroot\admin\_components\test.cfc: line 6

    4: < cfinvoke
    5: method = "superfunction".
    6: returnVariable = "myReturn" >
    7: < / cfinvoke >
    8: < cfset some_text = myReturn >

    OK, solved with all your advice!

    A big thank you to everyone

    Here is the final code for others...

  • Can I find out if I had to buy the Adobe Creative Suite 6 Design &amp; Web Premium, but I subscribed to photography CC for only one month plans, can I unsubscribe it and use the one bought instead?

    Can I find out if I had to buy the Adobe Creative Suite 6 Design & Web Premium, but I subscribed to photography CC for only one month plans, can I unsubscribe it and use the one bought instead?

    I subscribed to the creative cloud only because I did not know that my College courses will be using other software too.

    I hope to unsubscribe to the creative Cloud version and use the purchased instead.

    But if it is not possible, I'll just use the CC version for this year and use the one bought on my other PC.

    Hi, NGOs,

    Yes, if you intend to use CS6, you can still use it after the cancellation of the plan of the CC photography, you can also improve your plan to plan photography to Creative Cloud applications

    If you wish to cancel your plan well photography please contact support by calling/chat for cancellation requests and billing queries:

    https://helpx.Adobe.com/contact.html?step=CCSN_membership-account-payment_cancel-your-memb ership_stillNeedHelp

    * Be sure to stay connected with your Adobe ID before accessing the link above *.

    You can also check the help below document:

    https://helpx.Adobe.com/x-productkb/policy-pricing/cancel-membership-subscription.html

    Please go through the Adobe - General conditions of subscription as well.

    He hopes to help!

    Rayyan

  • Calling a function in the main sequence of a loaded swf file

    I know this is probably a very basic question, but I loaded a SWF file in another film. Now, I want to call a function in the main SWF file. Is it possible to do? Otherwise, I have a custom class where I could put the function, but I was not able to understand how to call it from the SWF loaded either. Can I somehow associate the class with the main movie, or...?

    Nevermind - I did something very stupid and was not calling the function as a method of a clip. I was just calling checkTarget (event) and not event.currentTarget.checkTarget (event); that seems to work.

  • call a function in the hull of the SWF to a SWF imported

    We have set flash up as a shell to retrieve data from the lesson in XML and display image by image.

    We import SWF files when the XML code that tells it to affix the frame.

    How can I get the SWF file imported to call a function in the hull...

    basically a button or movie clip in swf call imported the function "gotoNextFrame()" in the hull.

    We found an easier way to 'bit' if anyone is interested... We have an eventlistner added to the charger to assign an event in the swf file that is imported:

    flashLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, addEventHandlers);

    then when its done, it adds event listeners and calls our function "goNextFrame" (then it clears when its removed from the scene):

    function addEventHandlers(event:Event):void
    {

    var swfMC:MovieClip = event.target.content as MovieClip;

    swfMC.addEventListener ("NextFrame", goNextFrame);
    swfMC.addEventListener ("PreviousFrame", goPrevFrame);
    swfMC.addEventListener (Event.REMOVED_FROM_STAGE, clearEventListeners);

    }

    Then in the swf file that will be imported, its real simple:

    next_btn.addEventListener (MouseEvent.CLICK, MoveToNextFrame);
    prev_btn.addEventListener (MouseEvent.CLICK, MoveToPreviousFrame);

    function MoveToNextFrame(e:MouseEvent):void
    {
    dispatchEvent (new Event ("NextFrame"));
    }

    function MoveToPreviousFrame(e:MouseEvent):void
    {
    dispatchEvent (new Event ("PreviousFrame"));
    }

  • How to pass parameter in the function using the select statement?

    Hello

    I had a problem. I can't pass as parameter to the function by using the select statement. But it can pass as a parameter using the "code". How can I solve this problem?

    For example,.
    Select * from table (SplitFunction ('HS750020, HS750021')) < < < this work.

    but

    Select * from table (SplitFunction (select LOT_NO in the TRACER_SEARCH_SCHEDULE where JOB_ID = '36')) < < < do not work.

    Thank you for trying to help him. Thank you.

    Select * from table (SplitFunction (select LOT_NO in the TRACER_SEARCH_SCHEDULE where JOB_ID = '36'))< do="" not="">

    Try like this

    select * from table(select splitfunction(lot_no) from tracer_search_schedule where job_id='36')
    

    Just make sure that your subquery returns only 1 row.

  • Can we call a procedure in the select statement?

    Can we call a procedure in the select statement?

    Hello

    Raghu_appsdba wrote:
    Can we call a procedure in the select statement?

    # You can call functions, but not procedures.

    If the procedure does not change the State of the database (for example, it isn't updated all tables), then you can wrap it in a function, or re - write function.

    Here is an example of wrapping.

    CREATE OR REPLACE FUNCTION fun_x (in_txt IN VARCHAR2)
    RETURN  VARCHAR2
    IS
    BEGIN
            proc_y (in_txt);
            RETURN  in_txt
    END     fun_x;
    
  • How can I get Mozilla to use the name of the page for the name of the real instead of the URL bookmark when I bookmark a page

    I just noticed that (in comparison to Internet Explorer): in IE, when you preferred a Web page, it uses the actual name of the Web page (for example, for this page, it would be "Ask a Question Firefox Help" as the name of the bookmark), but in Mozilla, it uses the URL as the name of the bookmark. I was wondering if it was possible to change my Mozilla settings so that it uses the name of the Web page as the bookmark name instead of the URL? I hope that everyone understands what I am getting? If anyone can help me, I would really appreciate it. Thank you.

    Firefox uses the tag title for the name of the newly saved bookmark.

    When I bookmark on this forum page I get this for the 'name' of the bookmark.

    How can I get Mozilla to use the name of the page for the name of the real instead of the URL bookmark when I bookmark a page | Firefox Support Forum | Firefox help

  • 4655 HP Office Jet: How can I fax multiple pages using the hp officejet 4500 desktop computer

    How can I fax multiple pages using the hp officejet 4500 desktop that you just bought

    can you please email me at [removed personal information]

  • I'm unable to empty a jpg of the Trash because the element is used. How can I find what is using the element?

    I'm unable to empty a jpg of the Trash because the element is used. How can I find what is using the element?

    option of command, escape on the keyboard and then on the force quit button for all applications listed

    then empty the trash

  • How to make a lock off the internet so I can have another WiFi computer using the internet

    How to make a lock off the internet so I can have another WiFi computer using the internet

    you do not take the lock itself.

    Instead, you configure another computer with security information to access the connection Wireless secure.

    Unfortunately, we cannot help you with this, because we cannot tell if you are the owner of the wireless connection or someone trying to hack it via another computer.

    However, what you can try is to contact technical support that provides your internet service.  they will be well to validate your identity and then provide help or more detailed instructions.

  • I bought windows 7 in a store, but my windows xp cannot read the dvd. can I download 7 and use the product key, rather than buy it again?

    I bought windows 7 in a store, but my windows xp cannot read the dvd. can I download 7 and use the product key, rather than buy it again? I bought an old compaq desktop computer, and I want to update.

    It's probably too late because you have unsealed the package, but as you have relatively minor glitch of the material do not have a DVD player, did you use the (free) Windows 7 Upgrade Advisor to determine whether your computer hardware is capable of running Windows 7?

Maybe you are looking for

  • I get error message libraries does not properly. the sound on my computer doesn't work do not at all.

    Sound on computer not working do not at all.

  • Need help with graphics card upgrade

    Hi, I'm sorry if I posted this on a bad place in the forum. IM new here in any case, this is the current PC I have (http://support.hp.com/us-en/document/c02991104#N68) and I want to update the graphic card NVIDIA GeForce GTX680. But I know almost not

  • does not recognize Windows media, dvd player

    I have xp with media player 11. I also have a fast switching with six users on my desk. I think it's a fault of microsoft because a desktop Media Player recognizes DVD, on another it does not recognize my dvd player at all. Am I missing something her

  • describe the "sorting out."

    Hi allis there a qay have describe so its output in alphabetical order?So, instead of givingSQL > desc dba_profilesName                                      Null?    Typ----------------------------------------- -------- ----------------------------PR

  • How to change credit card information has expired

    Hello!We receive these details:Hello Luis stuff,.Our system has experienced difficulties your address for your site of treatment expenses. One of your payments failed to deal with against the credit card. The details of this order are listed below.In