Load/Unload Component from Main Application

I want to load in my main application 2 components. At this moment I load them with this:
<components:loadProject id="loadPrj" visible="false" click="loadPrj_clickHandler(event)" verticalCenter="7" horizontalCenter="0"/>
and I only set visible to true. Inside this component there is a canvas.
But, is there any other way to do this using an AS class file? I would like to load/unload it on click, not only set true/false to visible.

For dynamic creation and destruction of objects, you want to use ActionScript.
So in your main app file, you might have a button that triggers a click handler that does this:
private function myClickHandler()void {
                var b1:CustomComponent = new CustomComponent();
                var b2:CustomComponent = new CustomComponent();
                /// Be sure to add them to the display list if they are visual components
                myPanel.addElement(b1);
                myPanel.addElement(b1);

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.

  • Show component from main application mxml.

    Hi all,
         I have a main application mxml and inside has a button named show_form. After that, I design an form named Form_A. And now, I want when click on show_form button fire the Form_A and made it appear.
         Hown can I do this ?
         Thanks !

    There are many ways of doings this, it depends how your forms are shown.
    Are they in a ViewStack or similar container? If so just change the view from the click handler function for the button.
    If they are in a Canvas/HBox/VBox, in the click handler function of the button you can do a check like if Form_A.visible==true then submit it and hide it, else submit the other form. You can also have a variable that tracks if Form_A was submitted.
    If you have code, post it here and we can find the best solution with a clear example in front.

  • Run function in component from Main Application

    Hello all.
    I have my main.mxml application, that has a component inside of it.  The component is called <ns1:record/> with an id of "rec".
    This component has a function inside of it named doConnect(event:MouseEvent).
    Now i want to be able to add an event listener to a button on the Main.mxml that will run a function inside the component when clicked.
    I have managed to add an event listener to the Main.mxml that triggers a function held within the Main.mxml when a button clicked inside the component is clicked.
    I did this by using this code.
                <ns1:record id="rec" x="9" y="6" camera="{camera}" microphone="{microphone}" creationComplete="makeEvent()">
                </ns1:record>             //Event listener
                public function makeEvent():void {
                    rec.backbtn.addEventListener(MouseEvent.CLICK,swapstate);
                protected function swapstate(event:MouseEvent):void {
                    viewstack1.selectedChild=config;
    No matter what i try thou i cant get this to work the other way around.
    What i need help with is - clicking a button within the Main.mxml to run a function inside the component Record.
    If anyone can help that would be great !
    Thanks in advance.

    Hi djh88ukwb,
    From your post if I understand you correctly you want to listen for a event in record component when a button in main mxml is clicked...based on this
    assumption I am suggesting you a solution...
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete()">
    <mx:Script>
      <![CDATA[
       private function onButtonClicked(event:MouseEvent):void
       rec.swapstate(event);
      ]]>
    </mx:Script>
    <ns1:record id="rec" x="9" y="6" camera="{camera}" microphone="{microphone}" creationComplete="makeEvent()"></ns1:record>
    <mx:Button id="myBtn" label="Call Function in Record Comp" click="onButtonClicked()" />
    </mx:Application>
    <!-- In your record component Add a public function  swapstate as shown below-->
    public function swapstate(event:MouseEvent):void {
                    viewstack1.selectedChild=config;
    Please try this and let me know....
    Thanks,
    Bhasker

  • Dynamically loading help file from standalone application

    Hello All;
    I have written into my VI an option to load a help file (.chm) from my main application using the 'Open URL in Default Browser.VI'.  When I am in Development Mode, this works perfectly.  However, after I have compiled my VIs into an executable, this no longer works (i.e. nothing loads).  I am wondering if since the CHM file is not a default LabVIEW VI/LLB if this is where my problem is?  I have attached a BMP which shouls what I am doing.
    I did manage to get the CHM file to install with my application, but as mentioned, it will not load.  I have also attached a bitmap showing my build properties for this.
    Any assistance would be greatly appreciated.  Thanks.
    DJH
    Attachments:
    Loading CHM Files.zip ‏28 KB

    The change required for path information is really not all that hard to understand. If you use something like Current VI's Path, it will return c:\folder\example.vi. When an exe is created, each VI is put into the exe which is really a type of llb file. To prove this, just change the extension to llb and you can view the contents just like like any other llb file. Then the Current VI's Path will return c:\folder\application.exe\example.vi. So, the extra strip path is required to get the folder name. Using the application property App.Kind in your program allows the same program to work in the development mode ans as an exe. It would be difficult for the app builder to automatically add a strip path because it be next to impossible to know what the purpose of the Current VI's Path function is intended by the programmer. You can also simulate the behavior of the app builder by creating an llb and testing all of your path's there before doing the build. Also, by default, the app builder does create a \Data folder but when you do the build, you can change where certain files get installed to.
    Message Edited by Dennis Knutson on 05-22-2006 08:44 AM
    Attachments:
    Strip Path.JPG ‏10 KB

  • Loading web pages from an application

    Hi All
    I've tried hunting on this web site for info about how to show an html page from an application. Unfortunatley I couldnt find anything.
    So how do I fire up a web browser, and load in a specified web page?
    I can get a URL pointing to a file on my system ie File:c:/MyDoc/Help.htm, but am unsure what I need to do next.
    Any advice welcome.
    Cheers

    From an applet? - I assume this is a java web app ...
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;   
    public class URLCheckBox extends java.applet.Applet implements ItemListener {
       Choice chqbx = new Choice();
       Label lblOutput, lblfalse;
       URL url; 
       public void init() {
           this.setLayout(new FlowLayout());
                   chqbx.addItem("URL link to ..."); // add URL names here eg: www.yahoo.com/
           chqbx.addItemListener(this);
           setFont(new Font("Arial", 0, 18));
           setForeground(new java.awt.Color(255,255,55));
           setBackground(new java.awt.Color(95,100,215));
           lblOutput = new Label("Link to other web pages: ");
           add   (lblOutput);
           add(chqbx_MMedia);
           chqbx_MMedia.setForeground(new java.awt.Color(210,210,255));
           chqbx_MMedia.setBackground(new java.awt.Color(50,50,95)); 
       public void paint(Graphics g) { // this just makes it look pretty!
          g.drawRect(2,2,216,196);
          g.setColor(Color.white);
          g.drawRect(4,4,212,192);
          g.setColor(Color.blue);
          g.drawRect(6,6,208,188);
          g.setColor(Color.white);
          g.drawRect(8,8,204,184);
          g.setColor(Color.gray);
          g.drawRect(10,10,200,180);
       public void itemStateChanged(ItemEvent e) {
           String URLstr = "http://";
           String selection;
           selection = (String)chqbx.getSelectedItem();
           String urlText =  URLstr + selection";
              try {
                 url = new URL(urlText);        
                 getAppletContext().showDocument(url);
              catch(MalformedURLException ignore){ }
    }

  • Events from main application to components

    Could someone please tell me if it's possible to broadcast an
    event from the main application to components that have been
    declared inside the main application?

    For the number of rows in the DataGrid just look at the length of the dataProvider.
    For passing data between popups and app, the gold standard is to use custom events, and add the event listener to systemManager.
    Here are some tutorials on custom events I created:
    http://chikaradev.com/learning/flex3/customevents/StudentsTutoringCustomEvents1.pdf
    http://chikaradev.com/learning/flex3/customevents/CustomEventSimple/CustomEventSimple.html
    http://chikaradev.com/learning/flex3/customevents/CustomEvents1/index.html
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex Training and Support Services

  • Change States in component from main view

    The scenario like this:
    The main view includes many component views. On my main view
    there have a radio button to choice different role type, for
    example: admin and user. For different role have different views.
    But they don’t have big difference.
    My question is how could I implement my component view change
    states when I click button on the main view? I don’t want do
    change states in main view since I need create two component views
    for different roles.
    Thanks.

    Consider adding a second state to your application, even if
    you don't put anything into it.
    In each of the components that should change state when the
    role is changed, add a listener on the application for the state
    change event ("currentStateChange"). When this event is fired,
    query the application for its current state:
    var appState:String = (Application.application as
    Application).currentState;
    Use that to change the state of the component. Remember
    you'll also need to do this when your component is first
    created.

  • How to unload .dll from java application.

    Hi,
    I want to unload .dll (Library) for an specific event (Custom event).
    Thanks in advance.

    You can't.
    The closest that you can get is to create another dll that loads the first. And have a method that allows you to unload it.

  • Loading / unloading mvieclips from library

    Hi there:
    I have beel looking for this issue and can not find a good
    address: I need to load and unload movieclips which are on my
    library... (after clicking some buttons) How do I do it ? I have
    been trying loading as external SWFs and works, but this issue
    requires to be all in just in SWF file... please any idea ? thanks
    in advance,

    you need to specify linkage names for the said movieClips.
    then use the attachMovie(); method

  • Constructing a class extending JDialog when invoked from main application

    In an application that extends JFrame a method, showJDialogGUI, is called to instantiate an object of another class (called enterGUI) that extends JDialog. This object, enterGUIDialog, is modal; user must click on its Submit button in order to dismiss it and be able to continue in MainProgram. I have troubles getting error messages resolved when the constructor of the enterGUIDialog JDialog object is called. Perhaps there are other things wrong with below code. Any help appreciated - snippet of code from both classes is below.
    public class MainProgram extends JFrame {
    enterGUI enterGUIDialog; // declaration for object of class extending JDialog
    public MainProgram() {     // constructor
    myContainer = getContentPane();
    showJDialogGUI(); // calls method to initialize
    public void showJDialogGUI() {
    enterGUIDialog = new enterGUI (this, true);
    enterGUIDialog.setDefaultCloseOperation (DISPOSE_ON_CLOSE );
    enterGUIDialog.setSize(200,200);
    enterGUIDialog.setVisible( true );
    enterGUIDialog.show();
    } // end of class MainProgram
    public class enterGUI extends JDialog{
    Container myContainer;
    JPanel myPanel;
    //// How to call the constructor to create this JDialog????
    public loginGUI( JRootPane theRoot, boolean theModal ) // passed in 'this', and 'true'
    // or maybe??? public About(Frame parent, boolean modal) {
    this.setRootPane( theRoot ); //???????
    // or maybe ??? super(theRoot, flag);
    //super(theRoot, flag); // calls Dialog class constructor
    this.setModal( theModal ); // ?????
    myContainer = getContentPane();
    myContainer.setLayout( new FlowLayout() );
    thePanel = new JPanel();
    // next add components to JPanel, then add to the JDialog container
    fieldsPanel.add( pageLabel ); etc.
    myContainer.add( fieldsPanel );
    // etc.
    myContainer.setDefaultCloseOperation( DISPOSE_ON_CLOSE );
    myContainer.setVisible(true);
    } // end of constructor
    // more methods etc
    }

    Error received is:
    E:\Ghost>
    MainProgram.java:670: cannot resolve symbol
    symbol : constructor enterGUI (MainProgram,boolean)
    location: class MyPackage.enterGUI
    enterGUIDialog = new enterGUI(this, true);
    'new enterGUI(this, true); ' seems to be at start of
    error
    TIAThe error message could not be any more clear. To wit: the compiler is telling you it cannot find a constructor for class enterGUI that takes as parameters a reference to a javax.swing.JFrame, and a boolean value. Supply the constructor and the error will not be raised.

  • Load/unload

    Hi,
    The question is for ASO specifically.
    What would be the scenario where we need load/unload application/database scripts when we load the data?. Does it depend on the amount of data loaded or any other factor.?
    Can we eliminate the load/unload part from the script. (Essbase services are stopped/started overnight, so I assume this will take care of writing everythign to the hard disk from memory).
    Can you please share your thoughts on this?
    Thanks,
    Tom Thomas

    I can see the rational for doing it. There are some commands that will fail if the ASO cube is not loaded (It will not be auto loaded) so people put in the load command to make sure it is running. As for unload, if you had limited resources on the machine or wanted to consume a lot of memory for an application unloading applicaitons not being used frees up those resources. So people will stop the application when done loading so it does not use any resources until someone needs it. This is especially important when you have a ton of applications on a server. I have one client with over 100 applications and if they start them all, they run out of memory. Most of the apps are historical and are used very little so during processing they start the app, do an export(makes sure the app is still working) and then stops it then goes on and does the next one

  • Loading realscale image from memorycard.

    Hi.
    I made a big image (3550 x 2100 pixels), which my Nokia 6125 didn't zoom enough on the normal Picture preview.
    So I decided to make a program for it, so I could see all the details from the pic, and move around on the image. (Like zoom, but I need to get closer.. )
    First problem i encountered, was that 4mb application was too big to install on my memorycard... Darn limits...
    So I decided to add them seperately, that I'd load the image from the application.
    Well when I ran the "File Browser", there was 3 things:
    - ".." (Folder up)
    - "E:\" (crashes, no access)
    - "C:\" (crashes, no access)
    So any ideas how could I get it work properly?
    Thanks!

    hmm ... ok .. that sounds good .. but that means that
    a servlet must exsist at all time to display the
    required image.Servlets are usually instantiated by the servlet container upon an incoming request.

  • How to set the value of something in a component from the main application?

    Hi,
    Maybe I've been working on this too long, but I can't figure
    out how to set the value of the text property of a text input field
    in a component from my main application in an mx:Script block. I
    have a component called Login in the components folder, and I need
    to set the text value of empNum. In my mxml declaration at that the
    top, I've declared these components as xmlns:c="components.*" So
    logically, the property I'm trying to set is c.Login.empNum.text. I
    can't figure out the correct syntax to get this to work, and I've
    tried everything I can think of. Does anyone have any suggestions?
    I'm thinking this should be an easy one, and I'm just missing
    something.
    Thanks!
    Holli

    Did you try giving it an id ?
    <c:MyLogin id="loginScreen" /c>
    So later you can do loginScreen .empNum.text = "my text"
    Laurent,

  • How to contain a sub-component in the module instead of containing it in the main application

    Hi,
    I've 3 files
    Appln.mxml (application file)  ----  contains main application
    component.mxml (component file)  ----  contains component
    module.mxml (module file)  -----  contains module
    Generally the 'component.mxml' file will get loaded into the 'Appln.mxml' file (i.e., 'Appln.mxml' file will contain the custom component files) and whereas module file will get loaded on-demand.
    So Now instead of containing the data of 'component.mxml' file in the 'Appln.mxml',  I want to contain 'component.mxml' file data in the 'module.mxml' file itself and load the 'component.mxml' when module is loaded on-demand but not when application is loaded. So can any one please suggest me how to do it?
    Thanks in advance..

    Theo--
    You can delete software components & versions from the IR in XI 2.0.  (We're on Service Pack 5, and I've done it to clean up our IR.)
    Here is the process:
    1. Delete all configuration and/or import objects from the SCV.  Don't forget the 2 fault data types that SAP automatically creates in every namespace.
    1a.  Activate all change lists?  I don't remember for certain if this is needed here; if it won't let you save the deleted namespaces in step 2, then do this first.
    2. Double-click on the Software Component Version so that it comes up in the right pane.  Click on the change/edit button.  Delete all the namespaces from the SCV.  Save.
    3. Activate all change lists.  (It won't let you delete the SCV if you have uncommitted changes.)
    4. Open the SCV again (if it's not still open).  On the menu at the top of the right pane, go to Software Component Version...Delete.  You may or may not have to activate changes again.
    If I remember right, the software component will disappear automatically with the deletion of the last version.
    Hope this helps!
    --Dan King
    Capgemini

Maybe you are looking for

  • Windows 7 problem on imac27

    Hello, I am new here so please bare with me. I have the imac27 and a windows 7 disk with me, installed windows7 and its a problem. It would not install properly, although it did reach the windows installation screen when the imac rebooted..but then w

  • MR11 (GR/IR) Clearing in FM

    After the upgrade to ECC 6.0, the postings created from MR11 are posting in FM as a value type 66.  They should be posting as a value type 54.   I can't find any configuration where this could be changed.  Has anyone else run into this problem in FM

  • Is it possible to create an action to copy channel name text and insert into channel in CS5?

    I am a screen printer and I print my separations from Photoshop. I routinely work with multi channel files or RGB files with additional spot color channels. I have created actions to place my registration marks, re-size images, etc to get ready to pr

  • Finding my serial number without the disc/box/email.

    I have the program installed on my old computer, and it is still functional. I would like to download it onto my new computer, but when I look for the serial number in the program, the number it gives me cannot be verified when attempting to re-insta

  • Organizer in Elements 12

    I cannot load the organizer from the welcome page.  I get the processing bar then nothing.  I have tried re-installing but no change.