How can I call a public function in one component from another component?

I have two components: Form and Confirmation.  Form is a Canvas and Confirmation is a TitleWindow.
Form contains several controls and a submit button.  Confirmation contains an OK button.  When the user clicks the submit button, the Confirmation appears over the Form (Form is blurred).  When the user clicks the OK button on the Confirmation, I want to run a function on Form to set some default values in the controls.
How can I address the function in the Form component from the Confirmation component so I can fire the function?
Thanks!

Here is the source
CustomForm.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
<mx:Script>
<![CDATA[
public function callBack(): void {
lblStatus.text = "Success";
]]>
</mx:Script>
<mx:Label id="lblStatus"/>
<mx:Form x="50" y="50" verticalGap="15">
        <mx:FormHeading label="Send us comments" />
        <mx:FormItem label="Full Name:">
            <mx:TextInput id="fullName" />
        </mx:FormItem>
        <mx:FormItem label="Email:">
            <mx:TextInput id="email" />
        </mx:FormItem>
        <mx:FormItem label="Comments:">
            <mx:TextArea id="comments" />
        </mx:FormItem>
        <mx:FormItem>
            <mx:Button id="submit"
                label="Submit" />
        </mx:FormItem>
     </mx:Form>
</mx:Canvas>
CustomTitle.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" width="200" height="80"
showCloseButton="true" close="closeMe(event)"
backgroundAlpha="1"
color="#173553" backgroundColor="#EEEEEE"
headerColors="#FFFFFF, #CBCCCC"
borderColor="#666666" borderStyle="solid">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
public var callBack: Function = new Function();
private function closeMe(event: Event): void {
PopUpManager.removePopUp(this);
callBack();
]]>
</mx:Script>
<mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="bottom">
<mx:Button id="btnOK" label="OK" click="closeMe(event)" />
</mx:HBox>
</mx:TitleWindow>
TitleWindowSample.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns="*"
layout="absolute"
width="100%" height="100%"
creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
private function init(): void {
customForm.submit.addEventListener(MouseEvent.CLICK, onMouseClick);
private function onMouseClick(event: MouseEvent): void {
customForm.lblStatus.text = "";
var customTitle: CustomTitle = new CustomTitle();
customTitle.callBack = customForm.callBack;
PopUpManager.addPopUp(customTitle, this);
PopUpManager.centerPopUp(customTitle);
]]>
</mx:Script>
<mx:VBox
width="100%" height="100%"
verticalAlign="middle" horizontalAlign="center">
<CustomForm id="customForm" width="500" height="300">
</CustomForm>
</mx:VBox>
</mx:Application>

Similar Messages

  • How can i access all the objects of one schema from another schema

    Dear All,
    How can i access all the objects(Tables,Views,Triggers,Procedures,Functions,Packages etc..) and do the modifications of one schema from another schema (Without using synonyms concept).
    Thanks in advance,
    Mahi

    First of all, synonyms only help you easy reference the object. It doesn't have any implication of object privilege.
    As long as you have proper privilege on target object. You can access it with or without synonyms.
    Assuming you have proper privilege of objects, you can use following command to assume schema owner.
    ALTER SESSION SET CURRENT_SCHEMA = Schema_owner

  • How can we call a class file of one package for class file of another

    How can we call a class file of one package from class file of another package and both packages exist in a same folder

    How can we call a class file of one package from
    class file of another package and both packages exist
    in a same folder
    Luckily they don't so it's really not a problem after all.

  • How can I call a plsql function from an attribute?

    I have an attribute defined in an element. I want execute a PLSQL function from the attribute, and display the returne value with an HTML template.
    I've defined the attribute's type like PLSQL, and I've put the called of the function in the value of the attribute, but it doesn't work. The only value I obtain is an URL (I think that is the URL of the function or someting like this).
    How can I call to my function from the attribute and display the returnes value in the page?
    Thanks.

    Thanks, but it doesn't work. I have an attribute called ID_BOL and I want to associate a sequence to that attribute. I've created a function, with the sequence. This function return de value of the sequence. I want taht the attribute takes the value of the sequenece dinamically.
    I've tried it, creating the type attribute like PLSQL, and calling the function from the attribute, but it doesn't work.
    How can I return the sequence value to my attribute?
    Thanks.

  • How can I create a drawing like the one pictured from a photo?

    How can I create a drawing like the one pictured from a photo?

    OK, you are getting closer. Now, use your result, and place a Layer above that. Use the Pen Tool to create the "pen strokes" basically tracing over your background image. Then, when you have created each Path (or Sub-Path), choose Stroke Path, with probably the Pencil Tool and a Brush size that is small enough.
    Not sure which versions of PS these are good for, but here are some plug-ins, that might be helpful.
    AKVIS Sketch
    EdgeLine
    Sketch Effects
    Sketch Master
    I see that one of my old favorites, Flaming Pear's India Ink is not around any more.
    Good luck,
    Hunt

  • How can I to control any element of my GUI from another class?

    How can I to control any element of my GUI from another class?

    For that, you need the external class to have the reference to your element.. If your idea is to change basic properties like width, height etc.. then you can have the constructor of the external class to take the object of the parent of your class as the parameter and modify ..
    However, if the properties to be altered/accessed are custom to your element, then you will have to have the class accept an object of your class as the parameter. No other option..
    What exactly is your requirement?

  • How can I call a static function in another static function?

    /** = d, as a String, using exactly 5 characters.
    Precondition: 0 <= d <= 999.
    The truncated d will have one of the forms: ddd.d, dd.dd, and d.ddd.
    Examples are: 360.1, 29.50, 4.003, 0.001, and 0.000
    public static String truncateTo5(double d) {
    // To get the desired output, do the following
    // 1. If d < 0.001, set d to 0.
    // This prevents d appearing in scientific notation, e.g. 1.5E-6.
    // 2. Convert d to a string s, in the usual way.
    // s is guaranteed to have a decimal point in it a digit before
    // and after the decimal point.
    // 3. Append zeros to s (if necessary) until s has 5 digits.
    // 4. Return s.
    String s= "" + d;
    if (d < 0.001) {
    d= 0;
    return "0.000";
    if (s.length() > 5) {
    return s.substring(0,5);
    if (s.length() == 3) {
    int l= s.length();
    return s.substring(0, l) + "00";
    if (s.length() == 4) {
    int l= s.length();
    return s.substring(0, l) + "0";
    return s;
    /** = d, but rounded (if necessary) to its first 5 characters.
    PreconditionL 0 <= d <= 360.
    E.g. round 1.3546 to 1.355. round 1.3544 to 1.354.
    E.g. round 21.995 to 22.00. round 21.994 to 21.99.
    E.g. round 130.59 to 130.6. round 130.54 to 120.54.
    public static String roundTo5(double d) {
    // Hint. Rounding to an integer j is usually done by
    // truncating the value j + 0.5.
    // E.g. Change 10.6 to 11.1 and truncate to 11
    // E.g. Change 10.4 to 10.9 and truncate to 10
    // You need to do this sort of thing, but what you add may depend
    // on how big d is.
    What I need to do is call the truncateTo5() in the roundTo5() in order for this to work properly but I dont know how. Can someone help?

    @captfoss: If they're static methods in the same class, you don't even need to do that. You can just call the method unquallified.
    @OP: First off, when you paste code, wrap it in code tags. You can find them between Quote and Help.
    As for your error, you have defined truncateTo5() to take a double as an argument. When you call it, you are not passing it a double and you get that error.

  • How can i call userdefined java functions in a JSP ?

    Hi,
    i want to define some functions in a java class. is it possible to use these functions in a jsp ? how can i achieve this ?

    I suggest you call the function you want in either a custom tag or in the servlets/struts/jsf,... classes you are using.
    If you dont want those and you prefer scriplets then 2 step,s.
    First import the class then call it.

  • How can I call a server function by a button?

    Hello, world...
    I have a problem...
    I need to call a server function by pushing a button. I put the condition on the label...
    This is my script:
    writeBtn1.addEventListener (MouseEvent.CLICK,writeFile1);
    private function writeFile1 (e:MouseEvent=null):void
                 checkBtn = (writeBtn1.label == "Conferma" && textInput1.text != "" );  //my condition...
                 if (checkBtn)
                     nc.call ("WriteNow",null,textInput1.text+"\n");
                    writeBtn1.label = "Fatto";
    I'd like to call the function on the release of the button...
    Can someone helps me?
    Please...
    Emiliano.

    use:
    writeBtn1.addEventListener (MouseEvent.CLICK,writeFile1);
    writeBtn2.addEventListener (MouseEvent.CLICK,writeFile1);
    writeBtn3.addEventListener (MouseEvent.CLICK,writeFile1);
    private function writeFile1 (e:MouseEvent=null):void
                if(e.currentTarget==writeBtn1){
                 // do whatever
               } else if(e.currentTarget==writeBtn2){
                 // do whateverelese
              } else {
                 // it's writeBtn3

  • How can i call a c++ function through java

    Hi,
    dose anyone knows how to call a C++ function in java?
    Thanks.

    see JNI...
    basically declare a native method in your java class, then run javah on the class thus generating a *.h file. Then implement the c/c++ function. Compile the c/c++ part as a shared library, and make sure its accessible from your LD_LIBRARY_PATH env variable.
    Go through the steps in the JNI docs, and things shoulde be fine... hopefully ;)

  • How Can I Call a method in iView  ,which is in another iView

    I Have 2 iViews i want to call a method in Iview which is i another iView
    Thanks and Regards
    Prasad.Y

    Hi Prasad,
    first, welcom at SDN.
    Next, let us clarify some wording:
    A <i>PAR</i> is a <i>Portal ARchive</i>. It is a zip in a certain format. It contains a <i>portal application</i>.
    A <i>portal application</i> consists of <i>components</i> and/or <i>services</i>.
    An <i>iView</i> is somehow an "instance" of a <i>component</i>. It is created within the portal. There are <i>no iViews in a PAR</i> (like: "There are no objects in a JAR (but classes).").
    With this in mind, you know that the question does not work, for iViews don't have "methods".
    If you ask how you can call a method of a class belonging to a different component (but within the same portal app), it is no problem at all, each class has access to each other class within the same portal app (in fact, one has to differentiate between public and private part, but we don't want to go so far). To call use a class belonging to (the public part of) a different app, you will have to set the SharingReference within portalapp.xml.
    If that's what you're looking for - great.
    If not, ask again, but far more detailed.
    Hope it helps
    Detlev
    PS: Please consider to reward points for helpful answers. Thanks in advance.

  • How can i call a DLL file using invoke node from labview?

    I cant call a DDL function using call library function.so plz tell me how to use invoke node and call DLL using invoke node
    Please Mark the solution as accepted if your problem is solved and donate kudoes

    Please stay in the same thread.
    - Cheers, Ed

  • How can i call method defined in the binding page from popup

    I couldn't call method defined in pageDef from dialog exist in popup
    while i can call it from button or link
    how can I do that

    Hi,
    my answer to this is : yes, this can be done. So next is that you explain what you've tried so we can share our view with you
    Frank

  • How can I call external SSL application to enter Payments from EBS 10.5.10?

    Hello
    I am not able to do
    [Can I call any ActiveX control in the Forms under Oracle EBS 11.5.10 ?|http://forums.oracle.com/forums/thread.jspa?threadID=1086549&tstart=135]
    Now I am looking for some ideas or alternatives or suggestions.
    We are at EBS 11.5.10 on 9i and window environment.
    Background:
    We have a custom application that runs in EBS to enter payments againts Customers, Invoices or Orders. (pl do not recommand iPayments)
    When payment type is CreditCard upon saving a procedure calls a consol apps to charge the card electronicaly using Authorize.net APIs.
    Problem:
    Now this procedure of calling (consol apps) is not PCI compliance as unencrypted card number is passed to console app. (consol app is not using SSL connection)
    Solution:
    Created SSL web site using .NET and can call this using WEB.SHOW_DOCUMENT. Because this is external apps hence I can not get data/response back to calling form (Oracle EBS). This solution is not very elegant as user has to manually query (in the EBS) after saving/submitting/closing web page.
    Any other idea to improve above solution or or suggestions for new one. Except for payment part everything else in this suitation is in EBS.
    Thanks a lot.

    All Gurus please give some advice. Its is for EBS 11.5.10 (not 10.5.11 typo in the message title). Thanks..

  • How can we call a task in process definition A from Process definition B

    Hi,
    Is that possible to call a task in process definition A from Process definition B?
    Thanks.

    Sure, as long as you can come up with the correct query to lookup the task key for the task you want to run.
    provIntf.addProcessTaskInstance(taskKey, processInstanceKey);
    -Kevin

Maybe you are looking for