Help on parameters public static function

Hello

I have two functions in the same file, how can I use the first function as a default value in the second function.

public static function get decimalFormatter1 (): {NumberFormatter

//

}

I have try this:

public static void secondFunction(param1:String,_param2:Int=0,_ _param3:Function=decimalFormatter1_):Array {}

//

}

Error:-1047: unknown parameter initializer or isn't a compilation constant.

Any ideas?

Thank you!

To work around the problem, you can use null as default, where null means "use the decimalFormatter1. You have to write something like

public static void secondFunction(param1:String,_param2:int_=_0,_param3:Function_=_null):Array
{

trainer: function var = null;

If (param3 is nothing)

Formatter = decimalFormatter1;

....

}

Tags: Flex

Similar Questions

  • public static function return an object instance

    create or replace
    Item_object OBJECT TYPE IS
    (item_title VARCHAR2 (60))
    , item_subtitle VARCHAR2 (60)
    FUNCTION CONSTRUCTOR item_object
    RETURN SELF AS RESULT
    FUNCTION CONSTRUCTOR item_object
    (item_title VARCHAR2, VARCHAR2 item_subtitle) RETURN SELF AS RESULT
    , Public STATIC FUNCTION get_item_object (item_id NUMBER) ITEM_OBJECT RETURN
    MEMBER RETURN VARCHAR2 to_string FUNCTION)
    CANNOT BE INSTANTIATED NOT FINAL;


    create or replace
    TYPE item_object BODY IS
    Item_object FUNCTION CONSTRUCTOR RETURN self AS RESULT IS
    point ITEM_OBJECT: = item_object ('generic Title', 'Generic subtitle');
    BEGIN
    me: = item;
    RETURN;
    END item_object;
    Item_object FUNCTION CONSTRUCTOR
    (item_title VARCHAR2, VARCHAR2 item_subtitle)
    RETURN SELF AS RESULT IS
    BEGIN
    Self.item_title: = item_title;
    Self.item_subtitle: = item_subtitle;
    RETURN;
    END item_object;
    * STATIC FUNCTION get_item_object (item_id NUMBER) RETURN ITEM_OBJECT IS
    point ITEM_OBJECT;
    CURSOR c (NUMBER item_id_in) IS
    SELECT item_title, item_subtitle FROM point WHERE item_id is item_id_in;
    BEGIN
    I'm IN c (item_id) LOOP
    agenda: = item_object (i.item_title, i.item_subtitle);
    END LOOP;
    RETURN of goods;
    END get_item_object; *
    FUNCTION MEMBER to_string RETURN VARCHAR2 IS
    BEGIN
    RETURN ' ['|] [Self.item_title |'] ['|| [Self.item_subtitle |'] " ;
    END to_string;
    END;

    Impossible to compile static function get_item_object, can anyone help me please?

    user6446424 wrote:
    all instances of the object, as all the rows in the table

    I think you misuderstand objects. Objects do not come from thin air - it must exist somewhere or should be constructed from the data. Your function constructs the table utem data object. If you have any item in the table, which should be used?

    SY.

  • Help with public static functions.

    Hey everyone, I worked on a problem for a while and have finally understood just wrong. Google is not helped me to find the right way, so I'm posting it here. I sort of understand what's wrong with my code, but I have no idea how to do right. I'm a total noob to AS3, this is my first project.

    I have a main FLA file called game.fla with nothing on the stage, starting with. The document class is Main.as (shown below). The main class is supposed to manage the switching between the preLoader, mainMenu and game itself. The preloader loads and the player must press play to go to the main menu. The main menu is controlled by MainMenu.as, which adds event listeners for buttons game, instructions and credits. At the present time, instructions and credits just draw responses. When you click on play, I want to remove the mainmenu (not a problem with parent.removeChild (this)); and add the game. This is my problem comes in. I can't say parent.addChild (game), because honestly, I don't know how (I need to set a variable in hand or MainMenu and must it be public, static, etc?). Simplicity seems to be a function called initializeGame() that I could simply call of mainMenu. Problem: I have to do a static function, which doesn't let me use addChild, removeChild or any other variable that I create. Could someone please explain how I could do this job (even if it means change my structure. "I would be happy to learn a better way to deal with this kind of thing). Also, on a side note: if I can't use the static function with add or remove a child, can I optimize the effect later? I want later in my game, that I would need to call functions between classes, on a button click, for example, that affect the scene (or objects in the scene). Can I do it another way? For example, by clicking on an icon of the video game card clip, I would map the movieclip to load. A function that could be described seems the best way to do it, but I'm sure he can otherwise. Thank you much in advance. My code is below.

    Main.As

    package
    {
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;
    
        public class Main extends MovieClip
        {
            private var preLoader:PreLoader;
            private var mainMenu:MainMenu;
            private var game:Game;
            
            public function Main()
            {
                preLoader = new PreLoader;
                addChild(preLoader);
                preLoader.gotoAndStop(1);
                addEventListener(Event.ENTER_FRAME, barLoading);
            }
            private function barLoading(event:Event):void
            {
                var total:Number = stage.loaderInfo.bytesTotal;
                var loaded:Number = stage.loaderInfo.bytesLoaded;
                preLoader.loadingBar.scaleX = loaded/total;
                
                if (loaded==total)
                {
                    removeEventListener(Event.ENTER_FRAME, barLoading);
                    preLoader.gotoAndStop(2);
                    preLoader.doneLoading.addEventListener(MouseEvent.CLICK, doneLoading);
                    loaded = null;
                    total = null;
                }
            }
            private function doneLoading(event:MouseEvent):void
            {
                preLoader.doneLoading.removeEventListener(MouseEvent.CLICK, doneLoading);
                mainMenu = new MainMenu;
                addChild(mainMenu);
                removeChild(preLoader);
            }
            static public function initializeGame():void
            {
                game = new Game;
                removeChild(mainMenu);
                addChild(game);
            }
        }
    }
    

    MainMenu.as

    package
    {
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;
    
        public class MainMenu extends MovieClip
        {
            
            public function MainMenu()
            {
                playGameButton.addEventListener(MouseEvent.CLICK, playGameButtonFunction);
                instructionsButton.addEventListener(MouseEvent.CLICK, instructionsButtonFunction);
                creditsButton.addEventListener(MouseEvent.CLICK, creditsButtonFunction);
            }
            private function playGameButtonFunction(event:MouseEvent):void
            {
                playGameButton.removeEventListener(MouseEvent.CLICK, playGameButtonFunction);
                instructionsButton.removeEventListener(MouseEvent.CLICK, instructionsButtonFunction);
                creditsButton.removeEventListener(MouseEvent.CLICK, creditsButtonFunction);
                            
            }
            private function instructionsButtonFunction(event:MouseEvent):void
            {
                instructionsButton.removeEventListener(MouseEvent.CLICK, instructionsButtonFunction);
                trace("instructions");
            }
            private function creditsButtonFunction(event:MouseEvent):void
            {
                creditsButton.removeEventListener(MouseEvent.CLICK, creditsButtonFunction);
                trace("credits");
            }
        }
    }
    

    In addition, anny comments on my coding habits and how to improve are welcome.

    in the hand

    var preloader: Preloader = new Preloader (();)

    preloader.addEventListener ("preloadCompleted", preloadCompletedF);

    in the Preloader, loading complete:

    this.dispatchEvent (new Event ("preloadCompleted"));

  • Public static LOV

    Hello!
    (Version 4.0.2 of the APEX)

    I need definition LOV that returns multiple values for a display value. For example, when I select the return value TV is 1, when I select RADIO return value is 2. And when I select what I want to return to the 1 and 2 values.

    List of values definition should be something like this:

    STATIC: All; (1,2), TV, 1, RADIO, 2

    Is this possible? Without any plugin, like SuperLov...

    Thank you!

    Dark salvation,

    Maybe this thread could help?

    Public static LOV

    Kind regards
    Sandro

  • Problems related to the static functions

    Hello everyone, how are you?

    Here I am again with a question about static functions. I am building a class called "Photo Loader", its goal is to pass a url and a MovieClip with "PhotoLoader.loadPhoto." This method should return a bitmap that is added in the clips. I am not able to build a method I want to be independent of the Loader object. If anyone has experienced this?

    Kind regards

    you want to loadPhoto as a static getter?

    public static void loadPhoto(_bmp:Bitmap):void {value}
    BMP = _bmp
    }
    public static function get loadPhoto (): Bitmap {}
    return bmp;
    }
  • public static void

    Hello

    I have a public static void passing the name of my datagrid as string.

    public static function myFunction(myDG:String):Void
       
    {
            var myDG_length =
    this[myDG].dataProvider.source.length;

        }


    How can I do this [myDG] work here?

    I have try without luck:. dataProvider.source.length (myDG as DataGrid)

    Thank you

    Well maybe

    myFunction(this["whatever"]);

  • Problem with the passage of several parameters to a function

    Dear Experts,

    I have a strange problem while trying to pass parameters to a function in Csharp:

    On my database, I have a function like

    Mary of function (varchar2 parameter1, parameter 2 varchar2) return {number}
    ........
    }

    I want to write a csharp function that can perform these functions with different numbers and types of settings and always returns a number (see below).
    My problem is, I always pass that one parameter, the second parameter is not reach the database function, although I can see
    all parameters within the structure of the OracleCommand (dbcommand) object in the debugger.
    Can you give me a tip why my function does not work?


    Best regards

    Desperately Daniel



    It is my function:



    public override int insertDataSetwithReturn (String ProcCall, parameters of the ArrayList, ArrayList ParameterTypes, ArrayList ParameterNames)
    {

    int ReturnValue = 0;

    try {}
    Verification of conformity of the Arraylength
    If (!) (Parameters.Count) == ParameterTypes.Count)) {}
    wrong input! TODO!


    }



    MyDBConnection DBConnection = new DBConnectionORA();
    DBPOOL.getConnection (of the myDBConnection);
    OracleConnection myOracleConnection;
    myDBConnection.getConnectionout (of the myOracleConnection);

    DbCommand OracleCommand = new OracleCommand (ProcCall, myOracleConnection);
    dbCommand.CommandType = CommandType.StoredProcedure;

    Die nun aus der Parameterliste Columns setting.

    for (int ParameterCounter = 0; ParameterCounter < Parameters.Count; ParameterCounter++)
    {


    OracleParameter myParameter = new OracleParameter();
    myParameter.ParameterName = (String) ParameterNames [ParameterCounter];
    myParameter.OracleDbType = convertdotNetVariableTypesToDBVariableTypes ((String) [ParameterCounter] ParameterTypes);
    myParameter.Direction = ParameterDirection.Input;
    myParameter.Value = parameters [ParameterCounter];
    dbCommand.Parameters.Add (myParameter);
    }

    ReturnParameter OracleParameter = new OracleParameter();
    returnParameter.ParameterName = "ref_ret";
    returnParameter.OracleDbType = OracleDbType.Int16;
    returnParameter.Direction = ParameterDirection.ReturnValue;
    dbCommand.Parameters.Add (returnParameter);


    dbCommand.ExecuteNonQuery ();

    }


    catch (System.Exception e)
    {
    String MessageStr;
    MessageStr = "Error insertDataSet (DBConnection_ORA insertDataSet)." +
    Output +.
    e.get_Message () + "." +
    Output;
    MessageBox.Show (MessageStr, "Error in getArrayListfromProcedureNIP",
    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

    } //catch

    return ReturnValue;
    }

    Published by: danielwetzler on December 15, 2010 16:23

    Hello

    Can you give exactly the error generated by the application?

    You can try to overthrow the invocation of the parameters. This means that, try to invoke the returnValue parameter first and then the others (in settings) in the same order as you stated them in your stored procedure.

    in PLSQL, you have,
    Create or replace function (parm1 parm2 parm3 OUT varchar2, varchar2 IN IN varchar2)

    In your application, you must first write:
    blah blah blah parm3.direction = parm3.returnvalue

    and then
    blah blah blah parm1.direction = parm1.input
    blah blah blah parm2.direction = parm2.input

    Hope this helps you
    Walid

  • 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.

  • How to call a function of Instance inside a static function?

    Please help me.

    It's my static function: the function stillCallBack() is called successfully

    void MoreFunInPhilsCamera::stillCallback(camera_handle_t handle,
            camera_buffer_t *buf, void *arg)
    {
        MoreFunInPhilsCamera* inst = (MoreFunInPhilsCamera*) arg;
        emit inst->pictureSaved();
    }
    

    This is the warning:

    QObject::connect(this, SIGNAL(pictureSaved()), mTakePictureButton,
                SLOT(remove()));
    

    And I call the remove() function when the image is saved, but is not called

    void MoreFunInPhilsCamera::remove()
    {
        qDebug() << "I want to do something here, but this does not get called";
    }
    

    Check your signal connection. 'This' is the correct sender? is the slot to remove in your button?

  • Need help to understand political static with Nat No.

    Hi all

    I have a Pix 515e with 6 interfaces. 5 interfaces are considered as internal that we don't want any translation NAT occur between them. We want only NAT between the 5 and the external interface.

    I created a No_Nat ACL successfully to not manage any portion of nat.

    What I have trouble understanding is the static command to allow traffic between higher levels to lower levels and vice versa.

    I understand the

    public static inside_address outside_address (indoor, outdoor)

    for the part of NAT translation.

    What I do not understand, this is when the inside address and address outside are the same, what order are going. For example, my inner interface (192.168.1.0/24) (sec100) is where the live servers, and I have another interface named accounting (192.168.2.0/24) (sec75).

    If I don't want no nat occurs between these two, I have the following

    No_Nat of the 192.168.1.0/24 192.168.2.0/24 ip access list permit

    No_Nat of the 192.168.1.0/24 192.168.2.0/24 ip access list permit

    NAT (inside) 0-list of access No_Nat

    NAT (accounting) 0-list of access No_Nat

    Now how can I enter the static command?

    Maybe

    static (inside, accounting) 192.168.1.0 192.168.1.0 netmask 255.255.255.0

    or

    static (inside, accounting) 192.168.2.0 192.168.2.0 netmask 255.255.255.0

    or

    static (accounting, inside) 192.168.1.0 192.168.1.0 netmask 255.255.255.0

    or

    static (accounting, inside) 192.168.2.0 192.168.2.0 netmask 255.255.255.0

    I do not understand the prescription for it and why it would be used one verses the other way. Is the security level determines the order? Do I need two static command, one for each direction?

    Thank you

    Denny

    Hello denny

    static can be defined in any way... its only traffic that determines what it... for example, if accounting dmz is access to any server on your inside interface, you normally want the accounting servers see the original on its public IP server inside... so, you will end up as static

    static (inside, accounting) 192.168.1.0 192.168.1.0 netmask 255.255.255.0

    only the above static command is sufficient to establish connectivity between inside and dmz accounting. u don't need 2 static on any sense...

    Similarly, if you want to inside users to access a server on the dmz accounting, you can write a static type

    static (accounting, inside) 192.168.2.0 192.168.2.0 netmask 255.255.255.0

    hope you understand. Let us know if you need help... but normally a statement nat 0 is more than enough for the inside / dmz communication

    Kind regards

    REDA

  • public static problem (inside, outside)

    I use a PIX to isolate a subnet to a corporate network.

    inside is the corporate network

    outside is not approved LAN

    A single user in LAN not approved need to go to a specific set of IP addresses in

    And all other users can browse the Internet via downstream

    proxy server to talk to the corporate proxy server

    It works fine,

    Why I can't use the static suite for this

    public static 159.182.111.0 (Interior, exterior) 159.182.111.0 netmask 255.255.255.255 0 0

    problem is that I have to continue to add each ip address static statement such as

    public static 159.182.111.50 (Interior, exterior) 159.182.111.50 netmask 255.255.255.255 0 0

    public static 159.182.111.60 (Interior, exterior) 159.182.111.60 netmask 255.255.255.255 0 0

    public static 159.182.111.70 (Interior, exterior) 159.182.111.70 netmask 255.255.255.255 0 0

    public static 159.182.111.80 (Interior, exterior) 159.182.111.80 netmask 255.255.255.255 0 0

    Unfortunately this site VIEW use different IP addresses in the subnet, everyday

    Is any limitation of this ststic command at the low security access

    interface high security by using the static command

    Hi, I don't know, but the problem may be in the netmask in your static instruction,

    It must be 255.255.255.0 or so because it is a network and not a host.

    hope this helps.

  • Public static var - quick question

    Gidday

    Slowly converting my calendar code AIR dekstop app to OOP, and I'm at the part where I am loading in the user settings in a SQL table.

    I was wondering, is a public static var one good thing to use for holding user settings?

    I thought I had a class UserSettings user settings that may be held to get and set as they are needed or changed.

    Click Save, I can just walk them and save them in SQL.

    And all my classes can access them if necessary.

    Or is there a better way?

    See you soon

    Be more specific on what is YipeeClass and what he really needs. YippeeClass probably doesn't have access to all settings variables.

    For example, if YippeeClass is a point of view, he's probably just things it is designed to show. Provide you (getters/setters) properties on the view and then your main class for the Document (or better yet, a controller class dedicated) looked at the settings and fill in the properties of the display according to relevant parameters. Don't worry the Document class on how these parameters affect the view - it will be now responsible for displaying to translate the properties in any way (for example, to set the text of a text field). This is known as Dependency Injection.

    If the user interacts with the view in a way that impact parameters, send you an event to the view which is intercepted by a controller or the main document class and that class then will bring the necessary changes to the settings.

    Classes should always know the strict minimum necessary to accomplish all that they are directly responsible, and each class should be responsible for something.  I suggest you get the book associated with the links I posted: Actionscript 3 Design Patterns. At least she would give you a framework to think about such things.

  • How to make a link in textflow that send parameters to a function?

    How to make a link in textflow that send parameters to a function?

    In the examples included with the weekly builds, there is an example of CustomLinkEventHandler.as.  Passing parameters would be in the CustomClickHandler function.  You can set the parameters to the LinkElement that user using the setStyle API styles.

    Hope that helps,

    Richard

  • {} Public static

    Boy, it is difficult in 53 and feeling totally stupid, but Java can do it for me.

    I; have my head wrapped around statics and constants and static methods, and I found (thankfully) one of the examples which allowed me to analyze step by step to better understahnd the language (it's my best course).

    However, it baffles me: things wrapped in JUST {} public static.  I've been Googling like crazy, but all the explanations are either variables or class, not fopr this thing.

    Here is an example of the MemoryDemo example I discuss:

    // Statics -------------------------------------------------------------------------------------
    private static Random _random;  To generate random numbers for dates and channels.
    private static ubyte [] _letters; To generate random strings.
       
    // Constants -----------------------------------------------------------------------------------
    private static final int MIN_STRING_LENGTH = 3;   Minimum length for a random string.
    private static final int MAX_STRING_LENGTH = 10;  Maximum length of random string.
       
    public static
    {
    _random = new Random();
    _letters = new ubyte [MAX_STRING_LENGTH];
    }

    So, I understand not statements made by the statics and constants... no problemo.

    But what is the reasoning behind the encapsulating the _random and _letters inside the {} public static?  Is it just a kind of shorthand for something else?

    Again, I apologize for what must seem like stupid question, but I don't want to jump on something that I think moight be crucial to understand.  Thanks in advance (again)!

    -John

    I don't see why initialization that you see in this class could not be done as you suggest.

    However, there are other situations where this isn't the case.

    For example not elegant and simple (there are other better ways to dong that), you can have a static value that identifies whether the device is a touch screen,

    If you have

    public static boolean IS_TOUCH_SCREEN;

    public as well as any other class can test this just by using .IS_TOUCH_SCREEN

    {public static

    String pattern = DeviceInfo.getDeviceName ();

    If [(model.startsWith("95"))

    IS_TOUCH_SCREEN = true;

    } else {}

    IS_TOUCH_SCREEN = false;

    }

  • PhoneListener cannot access a public static vars initialized in the main thread

    Using the emulator (SDK 4.7, phone model 9500)

    I have a class PhoneListener defined and recorded, he gets the phone events without any problems. It's all public static public var that is initialized in the main thread is always null when it is examined in the context of the PhoneListener callback thread, when examined in the main thread or a son they are defined.

    I guess since the PhoneListener callbacks are called from a system thread, it cannot access the battery of my request - it seems correct? is this in any way about this?

    I tried Application.getApplication () .invokeLater (...), but validated all executable from the PhoneListener recalled suffers from the same problem.

    Thanks - Lindsay

    Exactly, that's what I was wondering - I found the answer according to the PhoneListener in the MIDlet . Now I store my UiApplication object in the running store and access them from the PhoneLister to publish objects on my main application via invokeLater.

    Thank you

    Lindsay

Maybe you are looking for