Quantcast
Channel: Adobe Community : Unanswered Discussions - After Effects
Viewing all articles
Browse latest Browse all 30854

Passing value to function clears textBox default value before onClick

$
0
0

I've created a "clearTextBox()" function so that when an edittext obj is clicked in the default text clears. It works untill I try to pass the "default" text into the function, inwhich case it clears the text without the onClick. See: "textBox.line01.onClick = clearTextBox(textBox.line01, defaultText01);"

 

 

 

myGUI(this);

   

function myGUI(thisObj){

    var myGUIPalette = myGUI_buildUI(thisObj);

   

    function myGUI_buildUI(thisObj){

        var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "User Input Panel", undefined, {resizeable: true});

       

        {//Build GUI

        res =   "group{orientation: 'column',\

                        titleGroup: Group{orientation: 'row',\

                            myStaticText: StaticText{text: 'Combined Team Word Interstitials'},\

                        },\

                        textLineGroup: Panel{orientation: 'column',\

                            line01: EditText{text: 'Enter Line 01 Text'},\

                            line02: EditText{text: 'Enter Line 02 Text'},\

                            line03: EditText{text: 'Enter Line 03 Text'},\

                        },\

                        buttonGroup: Group{orientation: 'row',\

                            clearButton: Button{text: 'Clear'},\

                            renderButton: Button{text: 'Render'},\

                        },\

                    }";

        }

       

        myPanel.grp = myPanel.add(res);

       

        //Defaults

       

       

       //Textbox Settings

        var defaultText01 = "Enter Line 01 Text";

        var defaultText02 = "Enter Line 02 Text";

        var defaultText03 = "Enter Line 03 Text";

       

        var textBox = myPanel.grp.textLineGroup;

       

        textBox.line01.text = defaultText01;

        textBox.line01.onClick = clearTextBox(textBox.line01, defaultText01);

       

        function clearTextBox(activeTextBox, defaultText){

            if(activeTextBox.text == defaultText){

                activeTextBox.text = "";

            }

        }

 

 

       

        return myPanel;

    }

   

   

    if((myGUIPalette != null) && (myGUIPalette instanceof Window)){

        myGUIPalette.center();

        myGUIPalette.show();

    }

}


Viewing all articles
Browse latest Browse all 30854

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>