Create a button in one component and use it in other component

Hello, I have a problem(is not the first time but I don't have very clear that problem and I'm asking again). I'm creating a button in one component doing that
Comp1:
public var btn=Button;
override public function main(args:IParams):void{
     var btn = new Button
    btn.label = ....
And now I want to use this button in another component:
Comp2:
private var dia:Object; //It's my own object, it's a Dialog but with my properties,a dn the dialog need (button,string,boolean)
private function onClick(event:Event):void{
                dia = new Object(HERE I HAVE TO PASS THE BUTTON , "Tittle", false);
I want know how can use the button that I have declared in the first component in my object. It's much more complicate but I have tried simplify my code.
I hope that somebody can help me.
Thanks!

I'm sorry, probably I'm explainign wrong, I don't know if it's for my english or because I don't know how to say, but this is not the problem. I will put the code because I think that ou could understand better. Forget the buttons, the problem is the window parameter
I'm very sorry because you're wasting time with me, but I hope that you can do the last try now with the code. If you don't understand something ask me before start thinking.
MyModule
<?xml version="1.0" encoding="utf-8"?>
<AbstractVisualModuleExecutable
    xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        <![CDATA[
            private var win:ITopComponent; //MY window
            private var dia:Dialog; //My Dialog
            override public function main(args:IParams):void{
                win = initContext.environment.createTopComponent();
                win.title = "Prueba Dialog"
                win.contentPane = this;
                win.visible = true;             
            private function onClick(event:Event):void{
                dia = new Dialog(win, "Title", false); ((Here I use the window, because I have to say to the dialog who is her father. Win is the father or the dialog, the dialog will create when I do click in one button of my window(the father).
                var btn2:Button = new Button();
                btn2.label = "Cerrar";
                btn2.addEventListener(MouseEvent.CLICK, function(event:Event):void{
                    dia.dispose();
                dia.contentPane.addChild(btn2);
        ]]>
    </mx:Script>
    <mx:Button id="btn" click="onClick(event)" label="Dialog" />
</AbstractVisualModuleExecutable>
Now I want to divide this applicatión in one module and one component.
MyNewModule (something like this):
<mx:Script>
        <![CDATA[
            private var win:ITopComponent;
            private var dia:Dialog;
            //Here I create the window
            override public function main(args:IParams):void{
                win = initContext.environment.createTopComponent();
                win.title = "Prueba Dialog"
                win.contentPane = this;
                win.visible = true;               
</Script>
MyNewComponent (something like this):
<Script>
          private var dia:Dialog;
         Here the instance of win I supose, but I don't know how. I have tried more than one thing
          private function onClick(event:Event):void{
                dia = new Dialog(here the win, "Title", false); //here I want to use the win that I have created in MyNewModule, but I only get a null when I execute the module. I don't know how can I do, instance.top or something like this I suposse it.
               //This part is not important
                var btn:Button = new Button();
                btn.label = "Cerrar";
                btn.addEventListener(MouseEvent.CLICK, function(event:Event):void{
                    dia.dispose();
                dia.contentPane.addChild(envio); //here I add the content of the dialog
                //dia.contentPane.addChild(btn); //here I add only a button without content, but don't worry about that, like I said later this is not important. The import thing is how can I use win when I create the dialog.
                dia.visible = true;
</Script>
<mx:Button id="toOpenDialod"  label="Open"  click="onClick(event)"/>
THANKS!

Similar Messages

  • How to deactivate the flex builder licence from one machine and use it on other machine

    Hi,
    I have a "Flex builder 3" licence running on my machine.
    I have to deactivate that and use it on another machine.
    How should I do that? As there is no otpion in flex builder.
    Any help appreciated.
    Thanks,
    Tushar

    What happens when you just install Flex Builder on the other machine and enter the serial number? I was not aware of Flex Builder having a mechanism that tracks activations like the Creative Suite products.
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance
    www.ChikaraDev.com
    Flex Development and Support Services

  • LG Optimus Zone. is there anyway to take the carama button off the screen and use one of the physical buttons on the phone to take pictures??

    Duplicate discussion - please see:
    LG Optimus Zone. is there anyway to take the carama button off the screen and use one of the physical buttons on the pho…
    Message was edited by: Admin Moderator

        Hello jr1984
    Awesome question. Unfortunately there isn't a way to reassign the buttons. There may be a 3rd party application for the camera that would have a  different option.
    JoeL_VZW
    Follow us on Twitter @VZWSupport

  • Include or create a view in the database and use this view?

    Well, I need to get related data of the main table from another related tables, so one way to do that is to use the Include method in Entity Framework to get this related data.
    However, I am thinking in another option, create a view in the database and use this view in entity framework. In this way, I avoid the needed of the include, because I think that is expensive in resources. But I am no very sure about that.
    I would like to know if the use of views on entity framework is a good idea to improve the performace or is better to use the include.
    For example, if I use the include I have the advantage that I get only one the main record and all the related data I have in the navigation properties, so the info is more shorted.
    Which is the advanteges and disadvantages of both methods to get related data in entity framework?
    Thank so much.

    Hello ComptonAlvaro,
    >>I would like to know if the use of views on entity framework is a good idea to improve the performace or is better to use the include.
    If your view would use a Join syntax to query master-child relationship tables, it actually is similar with the Include() method which actually results a duplicate records from master table, you could check this
    link for detail description.
    >>Which is the advanteges and disadvantages of both methods to get related data in entity framework?
    One visible difference is that records from Views are not editable by default(if you want edit them, you could refer to this
    blog).
    In your case, my suggestion that you could use the lazying load which will load the matter table once and disable the trace if you only need to display data.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Is it possible to open iPhoto twice under os-x lion to create a photobook on one desktop and to have a look to the photos in full size on the other desktop?

    Is it possible to open iPhoto twice under os-x lion, to create a photobook on one desktop and to have a look to the photos in full size on the other desktop?

    Ok let me ask you IF the IT department of your workplace does NOT want OS X installed on "THEIR" (The Companies) computers because of what they think is some type of security issue why are you trying to go against their wishes and install OS X on a computer that is NOT owned by you.
    That could cost you your job.
    If you continue down this path you will screw up the Windows install and have to take the system back to the IT department to get it fixed. What do you think they will say at that point?
    Do as you like but you would be better off just buying your own Mac computer if you are set on using OS X as your personal operating system.

  • IPad2 and a new MacBook running Lion, Both Devices use the same Apple ID which is a Hotmail eMail id. Can I create a new iCloud eMail Id and use iCloud eMail and continue to use my Hotmail Id for my Apple Id and use it for iTunes, iCloud

    I have an iPad2 and a new MacBook running Mountain Lion. Both Devices use the same Apple ID which is a Hotmail eMail id. Can I create a new iCloud eMail Id and use iCloud eMail and continue to use my current Hotmail Id for my Apple Id for iTunes, iCloud.
    Note, I will use both Hotmail and iCloud eMail.

    Welcome to the Apple Community.
    In order to change your Apple ID or password for your iCloud account on your iOS device, you need to delete the account from your iOS device first, then add it back using your updated details. (Settings > iCloud, scroll down and hit "Delete Account")

  • Creating a Master virtual hard disk and using the same for all other VM's

    Hi,
    We would like to create a master virtual hard disk and use the same for all other VM's. Can we do that ?
    my requirements :
    1) create 10 VM's
    2) first create a master virtual hard disk with win OS and use the same to create the 10 VM's.
    3) After creating the VM's change the HDD size.
                  -- if i have created master virtual disk with 500GB , and use the same for creating a virtual machine. can we change the HDD size to 1TB ?
    After creating the VM's ,i will change the system names and activate the windows accordingly.
    Will there be any implications ,if we can/will do like this.
    Thanks.

    Hi Suren424,
    I think Using Differencing Disks may cover your needs .
    Please refer to following setps:
       "Create the Parent Virtual Machine Configuration and Virtual Hard Disk
        Install the Operating System, updates, and common software
        Generalize the installation
        Prepare the parent virtual hard disk
        Create the differencing disks
        Create virtual machines that use the differencing disks
    For details please refer to follwing link:
    http://social.technet.microsoft.com/wiki/contents/articles/1393.hyper-v-virtual-machine-vm-parent-child-configuration-using-differencing-disks.aspx
    Hope this helps
    Best Regards
    Elton Ji
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • I entered calculates hands and more than one account and used a credit card please raise security measure for Visa card and thank you

    I entered calculates hands and more than one account and used a credit card please raise security measure for Visa card and thank you

    Hi Eva B.,
    Please refer to the help document below:
    Adobe Store | Online order and payment FAQ
    Regards,
    Sheena

  • My mum is always using my iPad and I want to set mode if you like that she can log in as some one different and use apps she likes and I can use a diFferent log in and use different apps and stuff

    My mum is always using my iPad and I want to set mode if you like that she can log in as some one different and use apps she likes and I can use a diFferent log in and use different apps and stuff

    iOS 7 does not support multiple user accounts like you want.
    If all the apps are different, you could set her up with her own page of apps, then just show her how to get to her apps page, or just buy her an iPad for herself.

  • Creating a button that flips back and forth on iPad in InDesign through DPS

    How do I create a button that flips back and forth on iPad in InDesign through DPS. I saw it on a food magzine on an ipad ... it's just a circle with text it in, when you click it the whole circle flips to the other side and there is a different color with different text. The circle does not change position, it just flips. Again, I want to do this so it shows up on the ipad through DPS.
    Thanks,
    Jay

    You need to create a Web overlay. There's an HTML example you can download and repurpose in this article:
    http://blogs.adobe.com/indesigndocs/2013/02/dps-tips-html5-examples.html

  • If i buy an iphone 5s sprint can i use it for CDMA? I ask that because i went out of the country one time and used it on a CDMA network but that was my iphon 5 not an i phone 5s.

    if i buy an iphone 5s sprint can i use it for CDMA? I ask that because i went out of the country one time and used it on a CDMA network but that was my iphon 5 not an i phone 5s.

    Sprint is a CDMA carrier, same as Verizon so it will work on CDMA.

  • Payment to one vendor and charge TDS for other no.of vendors against same invoice

    Is it possible to book invoice and payment to one vendor and charge TDS for other 3-4 vendors against same invoice.
    Is there any config require and any such process exist?

    Hi,
    Please go through the following process and see whether it suffice your requirement
    1. Create Vendor Invoice.
    2. Go to transaction code F-53
    Click on
    Click on
    Click on
    Click on Document - Simulate
    If entry is found O.K. Click on
    Hope, this solves your issue else revert.
    Regards,
    Tejas

  • In private browsing not working in Firefox 3.6.12 If I open yahoomail one session for one account and if I open other session for yahoomail, it automatically opens the earlier mail account.

    In private browsing not working in Firefox 3.6.12 If I open yahoomail one session for one account and if I open other session for yahoomail, it automatically opens the earlier mail account. But if I want to use more than one yahoomail accounts, in private browsing is not working. Please suggest.

    That problem isn't related to Private Browsing specifically, that's how Firefox works with regards to multiple "sessions" with the same server - only one logon is allowed at any time. Try using one of these extensions to be able to run multiple session cookies.
    Multifox: <br />
    http://br.mozdev.org/multifox/ <br />
    Cookie Swap extension: <br />
    https://addons.mozilla.org/firefox/3255/ <br />
    Cookie Pie extension: <br />
    http://www.nektra.com/oss/firefox/extensions/cookiepie/

  • How export a report in Excel where show Page Header in one sheet and the Body in other sheet?

    Hi,
    I need help!, because I need export a report in Excel where the Page Header shows in one sheet and the Body in other sheet. I have SQL 2008 R2, is it possible?
    Thanks a lot for your answers.
    Sukey Nakasima
    Sukey Nakasima

    Hi Sukey,
    If I understand correctly, you hope the Page Header shows in one sheet, the body and hidden page headers in another sheet when exports a report to Excel. To achieve this goal, we can put page header content into a rectangle, then set the visibility of rectangle
    using expressions. For more details, please refer to the following steps:
    1. Add a rectangle to the page header, then drag the page header content into it.
    2. Click the rectangle, in the Properties window, click Visibility, in the Hidden text box, click Expression, type the following expression:
    =IIf(Globals!RenderFormat.Name="EXCEL" and Globals!PageNumber <>1,true,false)
    3. In the Report Body, right click the Table Header row of the first tablix and select Tablix Properties, check Add a page break before check box.
    4. Click the tablix, in the Properties window, click PageBreak, in the Disabled text box, click Expression, type the following expression:
    =IIf(Globals!RenderFormat.Name="EXCEL",TRUE,FALSE)
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu

  • Can I copy the "Stage Area" and use it on other machine; R12; OEL 6;

    Hello All,
    I am trying to install R12 (with Vision demo database) on my Linux machine.
    I have copied the stage area from another machine, and I want to use it on this machine.
    I am trying to run the rapidwiz from the copied stage directory.
    It initiates, but is now ending up with a RW-5004 error.
    I have tried to install R12 several times now, but no success so far.
    I dont know the specifications for the last machine, but the staging has been done on a Linux platform.
    The present machine is
    RAM : 8 GB
    HDD : 400 GB
    OS : OEL 6 (64 bit)
    all the necessary packages are installed.
    Please Help !
    Thanking you all.
    Edited by: Udit apps dba on Apr 25, 2012 3:48 PM

    Hello Hussein Sir,
    I have read all your previous posts indication this error to be generic in nature.
    Well, I have read the error logs of different nodes, but without having much success in it.
    At last, after too much of trying I deleted my VM machine and now I am installing the machine again, with fingers crossed.
    My biggest question is "Can I copy the "Stage Area" of another machine of same configuration and use it on other machine" ?
    At last, I would request you sir to please forward me your personal email address (the one you use often).
    I shall be highly obliged.
    Regards,
    Udit Kulshrestha

Maybe you are looking for