Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6896629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:04:04+00:00 2026-05-27T07:04:04+00:00

I am passing in a function to another function which works well. Let’s say

  • 0

I am passing in a function to another function which works well. Let’s say function “inner” is being passed to function “outer”. My problem is that I want function “outer” to be able to check if there are any parameters in function “inner” and their type. I am using the inner function as a callback so it is important that it has one parameter of a specific type. I would like to catch any problems as early as possible so want the “outer” function to check this.

How can I check a function’s parameters? Is this possible in Flex?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:04:04+00:00Added an answer on May 27, 2026 at 7:04 am

    at compile time

    Actually it’s possible to have compile time checking. It just depends how big a leap you’re willing to make. For this to work you will have to write your code in Haxe instead of ActionScript and have it targeting the Flash platform when compiling. There’s a good read on Haxe function types on Devboy’s blog.

    at runtime

    If you don’t want to go that far, here’s how to do it in AS: you’ll have to use the describeType() function. Suppose you have a test class like this one:

    public class TestClass {    
        public function test(s:String):void {}
    }
    

    We can now get information about its functions by writing:

    var info:XML = describeType(TestClass);
    

    Somewhere in this XML object there will be a node that looks like this:

    <method name="test" declaredBy="net.riastar.test::TestClass" returnType="void">
      <parameter index="1" type="String" optional="false"/>
    </method>
    

    There it is! All the information you need to do your checking. But there’s one big caveat in this approach: the describeType method is not very efficient. If you have to do this a lot, it will slow down your application. You could use a caching strategy to avoid this though. Or have a look at the as3-commons-reflect project, it will take care of the caching for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am passing a vector pointer to another function which pushes data using that
I understand passing in a function to another function as a callback and having
I have an IF statement that consists of two separate function calls passing values
I'm passing to Django's template a function, which returns some records. I want to
I need to use a function which returns a table, in a inner join
Let's say I am building an web app that is connecting and basically parsing
I have a one-dimensional function minimizer. Right now I'm passing it function pointers. However
jCarousel documentation states the following: By passing the callback function itemLoadCallback as configuration option,
Passing an undimensioned array to the VB6's Ubound function will cause an error, so
I am passing a generic list to a function , i want to enumerate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.