Calling a method in Parent component from Title Window

Hi all,
I have a parent component that opens up a Title window when I
click a button. Now I want to call a method in that parent
component from the Title window. How do I do this in Flex? Could
anyone give me a hint please.
Thank you in advance for the help

"happybrowndog" <[email protected]> wrote in
message
news:gctmql$4t5$[email protected]..
> That's goddamned ridiculous. What were Flex developers
thinking that you
> have
> to write a custom event to call back to a parent
component?? Other GUI
> libraries such as WxWidgets, Fox, Qt, Delphi, MFC,
WinForms, etc., all
> allow
> you to either call via a reference to the parent object
or submit a
> callback
> function into the child object. That's just basic OO
programming. Flex
> is
> looking more and more ridiculous and more like Swing -
tons of unnecessary
> coding to do simple things.
You absolutely _do_ have the capability to pass in a
reference to the parent
component, or to create a "hard" reference to
Application.application. But
these are not recommended practices, because anything you
create this way is
then tied to an environment that implements those properties
and methods.
Q (3): I want to run a function in my main application from
inside my
custom component. But when I try to refer to myFunction() in
that
component, I get a compile time error Call to a possibly
undefined function
myFunction. How can I fix this?
A: Your component has its own scope, so it doesn't know
anything
about the functions in the main file. You can get around this
by directly
referencing the main application scope like this:
Application.application.myFunction(). However, this makes
your component
tightly coupled, which is a quick way of saying that your
component is only
usable in an application that has a myFunction() function in
it. You're
better off dispatching an event from your component and
letting the
application decide how to handle it. For more information,
check out the
following resources:
http://www.adobe.com/devnet/flex/articles/loose_coupling.html
http://www.adobe.com/devnet/flex/articles/graduating_pt1.html
From
http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf

Similar Messages

  • Calling a method in a component from main application

    Hi,
    I have a mxml component( menu1.mxml) . In the menu1.mxml
    there is a include for the actionscript file(menu1.as). In the main
    application page(SampleLogin.mxml) I want to call the method in the
    btnSubmit_Click() on the saveIndex() method for case 0. I am
    attaching all the code below

    case 0:
    menuOne.btnSubmit_Click( );
    break;
    Also it would probably be following best practices to used a
    custom event to pass the information in your "LoginButton_Click()"
    function to the application.

  • Is it possible to call a function in a parent component from a child component in Flex 3?

    This is probably a very basic question but have been wondering this for a while.
    I need to call a function located in a parent component and make the call from its child component in Flex 3. Is there a way to access functions in a parent component from the child component? I know I can dispatch an event in the child and add a listener in the parent to call the function, but just wanted to know if could also directly call a parent function from a child (similar to how you can call a function in the main mxml file using Application.application). Thanks

    There are no performance issues, but it is ok if you are using the child component in only one class. Suppose if you want to use the same component as a child to some bunch of parents then i would do like the following
    public interface IParentImplementation{
         function callParentMethod();
    and the parent class should implement this 'IParentImplementation'
    usually like the following line
    public class parentClass extends Canvas implements IParentImplementation{
              public function callParentMethod():void{
         //code
    in the child  you should do something like this.
    (this.parent as IParentImplementation).callParentMethod();
    Here using the Interfaces, we re decoupling the parent and the child
    If this post answers your question or helps, please mark it as such.

  • Call a method in the view from Component Controller

    Hi Friends,
    I have written the code for calling the RFC in Component Controller.
    My requirement is to change the properties of UI elements in the view, if I get any exception while calling RFC.
    Can Call a method in the view from Component Controller.
    Regards,
    Lakshmi Prasad.

    HI,
    You can get the error message during the exception of calling RFC in view itself.
    Any way you may call the RFC at some action in the view only.
    Can you explain me what you are trying to do?
    Kind Regards,
    Mukesh

  • Need call a method of one iview from another iview

    Hi,
    There are 2 iviews in a component.
    1) FirstView - contains abc() method & xyz() methods
    2) SecondView (a popup) - asdf() method
    i want to call abc() method from asdf() method. i.e. i want to call a method of the firstview from the secondview.
    Note:
    1) i couldn't able to copy the code of abc() method to component controller, as it has the code which uses (iview) local attributes (this can be done by context mapping) & main reason is from the method it calls the xyz() method of the same view (again i couldn't call a method of iview from component controller).
    2) firstView contain 5 tabs, i want to be in the same tab from which secondview (popup) was called, if i use fire plugs between both view, the current tab will be chnaged (i suppose, not sure).
    3) can we use event handlers, if yes how can we do that.
    Please provide a better solution for calling a method of view from another view.
    Thanks
    Maha
    Edited by: Maha Hussain on Jan 13, 2009 12:40 PM

    Hi Maha,
    It is better to have such methods in the component controller to make it reusable and avoid writing same code again and again.
    You can have that method in component controller and call that method on click on a button from Iview1 and can pass the parameters in the mthgod only.
    for example.
    Say Method abc() which is currently in Iview1 and you are passing values from context say aa bb cc to the method now what i am suggesting is
    have that method abc(String aa, String bb, String cc) ;
    and call it on click on button in Iview1 and pass the required parameters.
    Hope this will help
    Regards
    Narendra

  • Is it possible to call a method in a servlet from  a java script ?

    I need to do a dynamic html page . In the page i select some things and then these things must communicate whit a servlet because the servlet will do some DB querys and update the same webpage.
    So is it possible to actually call a method of a servlet from a java script? i want to do something that looks like this page:
    http://www.hebdo.net/v5/search/search.asp?rubno=4000&cregion=1011&sid=69DHOTQ30307151
    So when u select something in the first list the secodn list automaticly updates.
    thank you very much

    You can
    1. load all the options when loading the page and
    set second selection options when user selected
    the first; or
    2. reload the page when user select first selection
    by 'onChange' event; or
    3. using iframe so you only need to reload part of
    the page.

  • Calling a method in BPM Object from jsf page

    Hi All,
    How do I call a method in BPM object from JSF page? Is it possible to invoke it in a manner similar to invoking a method from managed bean in JSF application?
    Please help.
    Thanks and Regards,
    Veronica

    You can use f:invoke (or f:invokea to with parameters)
    For ajax calls, you can use f:invokeUrl to get the URL to a particular method within your BPM object, although make sure the Server-Side Method property is set to Yes.
    http://download.oracle.com/docs/cd/E13154_01/bpm/docs65/taglib/index.html

  • Calling a method on a jFrame from a jPanel that created by the jFrame

    Hi all
    I can not for the life of me work out how to do this.
    Calling a method on a jFrame from a jPanel that created by the jFrame.
    I have used this code to set a handle for one jPanel to another.
    i.e I can create new jpanel and pass in handles from one to another but not back to the jFrame.
    // this is sudo code
      private Panel_Top topPanel;
      private Menu_Panel menuPanel;
      private DataPanel dataPanel;
    //create new
        topPanel = new Panel_Top();
        menuPanel = new Menu_Panel();
        dataPanel = new DataPanel();
    // add handles from one to another
        menuPanel.setDataPanel(dataPanel);
        topPanel.setDataPanel(dataPanel);
        topPanel.setMenu_Panel(menuPanel);
        dataPanel.setMenu_Panel(menuPanel);
    // in each class I use this to set
      public void setDataPanel(DataPanel dataPanel) {
        this.dataPanel = dataPanel;
      }But I can not seam to get a handle back to the jFrame that created it.
    Please help
    as you can see I am trying but no luck so far
    Thanks

    class Life extends JPanel{
          pulic Life( JFrame owner )
                owner.doSomething(); // pass the JFrame to the constructor and feel free to use it
    }[code[                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Calling a method of one class from another withing the same package

    hi,
    i've some problem in calling a method of one class from another class within the same package.
    for eg. if in Package mypack. i'm having 2 files, f1 and f2. i would like to call a method of f2 from f1(f1 is a servlet) . i donno exactly how to instantiate the object for f2. can anybody please help me in this regard.
    Thank u in advance.
    Regards,
    Fazli

    This is what my exact problem.
    i've created a bean (DataBean) to access the database. i'm having a servlet program (ShopBook). now to check some details over there in the database from the servlet i'm in need to use a method in the DataBean.
    both ShopBook.java and DataBean.java lies in the package shoppack.
    in ShopBook i tried to instantiate the object to DataBean as
    DataBean db = new DataBean();
    it shows the compiler error, unable to resolve symbol DataBean.
    note:
    first i compiled DataBean.java, it got compiled perfectly and the class file resides inside the shoppack.
    when i'm trying to compile the ShopBook its telling this error.
    hope i'm clear in explaining my problem. can u please help me?
    thank u in advance.
    regards,
    Fazli

  • How to call main method in one class from another class

    Suppose i have a code like this
    class Demo
    public static void main(String args[])
    System.out.println("We are in First class");
    class Demo1
    public static void main(String args[])
    System.out.println("We are in second class");
    In the above program how to call main method in demo calss from Demo1 class......???????

    No, i dont know how to call other than main methods from other classes
    And one more doubt i have i.e. Like in C can we see the execution of the program like how the code is being compiled step by step and how the value of the variable changes from step to step like(Add Watch).........

  • Cross-component: Call method of using component from within used component?

    Hi,
    I began diving into cross-component programming.
    Meanwhile after having digged into some scenarios some questions came up to my mind that I am not able to answer myself. I would appreciate your help here!
    Say we have to components.  Comp A uses Comp B (hence, B is a component usage in A)
    1) How to make them communicate not on a data level (via context binding) but on a process level, thus...
    a) can I call A's method from within B? How is the approach on a general level? - as B can be used from totally different components (like A, A1, A2 ...)
    b) perhaps the only way to do this is by firing events? If so, how can I react in A when an event in B (marked as interface event) gets fired? As it seems they do not get registered within A directly...
    I guess the question seems to be a bit tricky. Nevertheless, I think there will be plenty of you out there who used to asked them the same questions before and came up with an approach. Would be nice to hear from you.
    Best wishes,
    Marc @sap1

    Hi,
    thanks for your reply!
    Indeed, I think the nature of WDA would be just to somehow map the context from the used component to the other back and forth.
    Nevertheless, what if I would like to invoke a method of the using component from inside the used component.
    One sample for this requirement could be e.g.:
    Component B offers a tree item and a send/verify button.
    Component A uses B and has some restraints regarding what the selection should look like.
    The user taps the button in B (at runtime in the view container of A), the context gets updated in A and B and in Component A the verifyWithOwnConstraints() method gets called (through B).
    Thanks again,
    Marc

  • How to call partial trigger on JSFF component from separate managed bean?

    Guys and Gals,
    Using JDev 11.1.1.2.0. Looked on the forums and google. Initial results aren't so great.
    Is it possible to call a PPR on a JSFF component from a separate managed bean? It seems calling the FacesContext in this instance calls the root JSPX, which only contains one child: the RichDocument.
          UIComponent component =
             FacesContext.getCurrentInstance().getViewRoot().findComponent("pc1:table1");
          if (component != null)
             AdfFacesContext context = AdfFacesContext.getCurrentInstance();
             context.addPartialTarget(component);
          System.out.println(FacesContext.getCurrentInstance().getViewRoot().getChildCount());Returns 1 :(
    Ideas for a workaround?
    Edited by: LovettWB on Nov 17, 2010 3:39 AM
    Edited by: LovettWB on Nov 17, 2010 4:11 AM
    Edited by: LovettWB on Nov 17, 2010 4:12 AM

    Thanks! Joonas, you've been a great help.
    The code on the page you referenced was close, but the code on a page referenced in the user comments was even better:
    http://www.jroller.com/mert/entry/how_to_find_a_uicomponent
    My region is located in a facet, which the page you posted doesn't quite cover, but the page above fixed that. Here's the fix below:
    In Managed Bean
          // search for the region ID (or task flow) in the base page
          UIComponent base = jsfUtils.findComponentInRoot("dynamicRegion");
          // now find component ID from within that region
          UIComponent partTable = jsfUtils.findComponent(base, "partTable");
          // call PPR on your found component
          AdfFacesContext.getCurrentInstance().addPartialTarget(partTable);In JSFUtils utility class
       // used to locate region.  Could also find any component
       // located in the base ViewRoot()
       public static UIComponent findComponentInRoot(String id) {
        UIComponent component = null;
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext != null) {
          UIComponent root = facesContext.getViewRoot();
          component = findComponent(root, id);
        return component;
        // Recursive method which finds your component within JSFF
        // regardless of facet or other UIComponents which may have children
    public static UIComponent findComponent(UIComponent base, String id) {
        if (id.equals(base.getId()))
          return base;
        UIComponent kid = null;
        UIComponent result = null;
        Iterator kids = base.getFacetsAndChildren();
        while (kids.hasNext() && (result == null)) {
          kid = (UIComponent) kids.next();
          if (id.equals(kid.getId())) {
            result = kid;
            break;
          result = findComponent(kid, id);
          if (result != null) {
            break;
        return result;
    }Good stuff to know!

  • How to call a method in one JSP from another JSP?

    say that I have 2 JSPs.
    JSP one has a button.
    JSP two has some method that, say, find the square root of the number passed from JPS one.
    How to - when click - the button on page one call the method on page two?
    Please note that I can not use object binding, but I want passing the actual parameter and call the method on page two.
    Please note that this is an update of a previous post on the same topic called "Object scope".
    Thank you all very much.

    No, i dont know how to call other than main methods from other classes
    And one more doubt i have i.e. Like in C can we see the execution of the program like how the code is being compiled step by step and how the value of the variable changes from step to step like(Add Watch).........

  • Calling a method in BPM Object from jsp page

    hi all,
    I try to call a method from BPM Object using <f:invokeUrl >
    I change server side method properties to yes.
    and then how can i get request and response object inside the BPM method.
    Thanks.

    Thanks for ur response,
    But i mention about BPM method inside BPM Object.
    i found this inside the documentation.
    methodName(Fuego.Net.HttpRequest request, Fuego.Net.HttpResponse response)
    i need to match above BPM method and <f:invokeUrl > tag. am i right?
    But i don't know how to create method with argument "Fuego.Net.HttpRequest request, Fuego.Net.HttpResponse response" inside BPM Object.
    I can't find any place to define method argument inside Oracle BPM studio.
    I don't know how to parse argument like "Fuego.Net.HttpRequest request, Fuego.Net.HttpResponse response"
    With Regards,
    Wai Phyo
    Edited by: user8729650 on Sep 9, 2009 7:03 PM
    Edited by: user8729650 on Sep 9, 2009 9:20 PM

  • Calling a method on a component placed in a tab?

    I create a tabbed pane. I create x number of tabs in it each with one component. Now I want to call a method on one of those components. How might I do this?
    Here was my thought but it is giving me a nullPointerException at the line where I call temp.buildChart(). I guessing that I am not doing this right?
    for (int i = 0; i  < graphTabs.getTabCount(); i++){
                                ChartPlotter temp;
                                temp = (ChartPlotter)graphTabs.getTabComponentAt(i);
                                temp.buildChart();
                                graphTabs.setEnabledAt(i, true);
                            }Edit: If it matters any the component of the tab is a JPanel that displays three charts.
    Edited by: Sch104 on Jul 1, 2008 12:38 PM

    Didn't completely fix the error, but I placed the buildChart() call somewhere else that made sense.
    Edited by: Sch104 on Jul 2, 2008 7:37 AM

Maybe you are looking for

  • Acrobat 9.4.2 hangs on name changes when "file as"

    Running Windows 7, 64 bit. If I accept the filename, all works well. If i click in the name to modify it, computer hangs. If I wait long enough (I think) it finally works, but takes MINUTES.

  • IPAD 2 Connectivity

    My IPAD 2 is quite new. My connection to my home network has been working fine ... but has suddenly stopped working. When I go into Settings/WIFI I can turn the swith on but it doesn't seem to do anythin ... the WIFI setting still shows as OFF on the

  • Problem with ios certificate server not updating the CRL

    Hi all, The background is that i'm currently setting up a DMVPN solution with the ipsec tunnels between the spokes created using certificates. I'm using a cisco 877 as the CA server (its running 12.4(6)T5) to provide the certificates to the spoke rou

  • Sos about install "Oracle9i JDeveloper Release Candidate for Windows NT2000"

    I have unzip the jdev9irc.zip in a directory named "d:\jdevelop9i". After I made a project with a applet and deploy it into "OC4J", I check using "http://192.168.16.201:8888//mytest-applet2- context-root/untitled1.html" It failed to load my class. Do

  • NEF raw format

    I have a Nikon D5200, and I take pictures in the NEF raw format. My Photoshop elements 11 does not seem to recognize this format and will not bring up any photos taken in this format, yet my Nikon supplied software does. I want to use elements 11 is