Execution of function in the main Application component

Hi all.

I have my main.mxml application, with a component inside.  The component is called < ns1:record / > wearing the id "rec".

This component has a function named doConnect(event:MouseEvent) inside.

Now, I want to be able to add an event listener to a button on the Main.mxml that will perform the function inside the item when you click on it.

I managed to add an event listener to the Main.mxml that triggers a function which is held in the Main.mxml when a button clicked inside the element is clicked.

I did it 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 you can't get do this the other way around.

I need help what - by clicking on a button in the Main.mxml to perform a function within the Record element.

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 an event by calling record when a main mxml button is clicked... on this basis

hypothesis, I propose you a solution...


http://www.Adobe.com/2006/mxml"layout ="absolute"creationComplete =" onCreationComplete () ">"

    
private void onButtonClicked(event:MouseEvent):void
{
Rec.swapstate (Event);
}
]]>



public void swapstate(event:MouseEvent):void {}
viewstack1.selectedChild = config;
}

Please try this and let me know...

Thank you

Jean Claude

Tags: Flex

Similar Questions

  • listening in the main application for event from custom component

    I have a component that custom im using an identifier.  I watch videos and tutorials on how to pass variables between applications and custom components. the problem im having is that tutorials or explanation you put the event on the custom component and then it refers to a function in the main application.

    Is a fair way to listen on the main application at the event begins? Ive been tempting for hours and I know there must be something im missing may not be so difficult. any help, I would be really grateful.

    Thank you

    Miguel

    Hello

    The following example has been done as a simple demonstration of States, but the connection (state1) component, is a simple custom event which is sent by the ok button on the connection, the event could be extended to transfer the information to connect to the main application, in this case because the login screen is always public vars or fields of the box would be available for the main application anyway.

    http://gumbo.flashhub.NET/Wizard/ source included

    David.

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

    Hello

    Maybe I've worked on it too long, but I can't understand how to set the value of the text property of a text entry field in my main application component in a block of mx:Script. I have a component called Login in the components folder, and I need to set the text value of empNum. In my statement of mxml up there, I said these components such as xmlns = "components.*" so, logically, the property, I'm putting a c.Login.empNum.text. I can't understand the correct syntax to make this work, and I've tried everything I can think of. Does anyone have any suggestions? I think this should be easy, and there is just something missing me.

    Thank you!
    Holli

    Have you tried to give him an id?

    If later you can make the loginScreen. empNum.text = "my text".

    Laurent,

  • Is it possible to have a common accessible file location for the main application in the sandbox and its extension app plugin

    I'm trying to launch an app on the app store for mac. The bundle of the main application and everything inside it is on sandbox.

    The main application Bundle identifier is com.xxx.core.app . The identifier for the internal Plugin Finder Extension application Bundle is com.xxx.core.app.extensions .

    Now the problem is the extension inner finder is also available in sand and trying to read a file written by the main application.

    The main application writes the file location depending on mac OS X, for example temp/var/folder/jv11743453495593/T/com.xxx.core.app

    But the internal Plugins try to read/var/folder/jv11743453495593/T/com.xxx.core.app/extensions

    Because of the different bundle identifiers, they have different containers.

    Can someone let me know how to limit the same application and its plugins to the same folder location. Does perform a work around for this problem.

    Hello yuktikapahwa,

    See the Sandbox Apple Guide under the ApplicationDirectory group container

    You must create a group that your container can access. I'm not 100% certain that this will work with extensions of Finder, but it seems the most logical place to start.

  • A fatal bus error was detected on the function of the peripheral bus component 0 7 0

    Hi all

    I'm trying to diagnose a hardware problem with my Dell PowerEdge R410. The problem occurred after a kernel patch and reboot linux security (I'm under Ubuntu 14.04 and I'm on Linux 3.13.0 - 100-generic). Initially, the machine would crash when starting in the BONE, but I managed to do always start too.

    I see the following errors:

    --------------------------------------------------

    Severity: critical
    Date and time: Saturday 22 Oct 05:50:30 2016
    Description: A fatal bus error was detected on the function of the peripheral bus component 0 7 0.

    Severity: critical
    Date and time: Saturday 22 Oct 05:50:30 2016
    Description: A fatal bus error was detected on an element at location 1.

    ----------------------------------------------------

    I'm having a hard time figuring what component, it exactly. Here is the result of lspci:

    ------------------------------------------------------------------------------------------------

    00:00.0 Host bridge: Intel Corporation 5500 IO Hub port ESI (rev 13)
    00:01.0 PCI bridge: Intel Corporation 5520/5500 / X 58 i/o Hub PCI Express Root Port 1 (rev 13)
    00:03.0 PCI bridge: Intel Corporation 5520/5500 / X 58 i/o Hub PCI Express Root Port 3 (rev 13)
    00:07.0 PCI bridge: Intel Corporation 5520/5500 / X 58 i/o Hub PCI Express Root Port 7 (rev 13)
    00:14.0 PIC: Intel Corporation 7500/5520/5500 / X 58 i/o Hub System Management records (rev 13)
    00:14.1 PIC: Intel Corporation 7500/5520/5500 / X 58 i/o Hub GPIO and Notepad records (rev 13)
    00:14.2 PIC: Intel Corporation 7500/5520/5500 / X 58 control status of e / Hub and RAS records (rev 13)
    00:1 a. 0 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #4
    00:1 a. 1 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #5
    00:1 a. 7 USB controller: Intel Corporation 82801JI (ICH10 family) USB2 EHCI Controller #2
    00:1d.0 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #1
    00:1d.1 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #2
    00:1d.2 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #3
    00:1d.3 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #6
    00:1d.7 USB controller: Intel Corporation 82801JI (ICH10 family) USB2 EHCI Controller #1
    00:1E.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 90)
    00:1F.0 ISA bridge: Intel Corporation 82801JIR (ICH10R) LPC Interface Controller
    00:1F.2 IDE interface: Intel Corporation 82801JI port (ICH10 Family) SATA IDE Controller #1 4
    00:1F.5 IDE interface: Intel Corporation 82801JI port (ICH10 family) SATA IDE Controller #2 2
    01: 00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5716 Gigabit Ethernet (rev 20)
    01:00.1 Ethernet controller: Broadcom Corporation NetXtreme II BCM5716 Gigabit Ethernet (rev 20)
    Serial Attached SCSI 03:00.0 controller: LSI Logic / Symbios Logic SAS2008 PCI - Express Fusion - MPT SAS-2 [Falcon] (rev 03)
    04:03.0 VGA compatible controller: Matrox Electronics Systems Ltd. MGA G200eW WPCM450 (rev 0a)
    Fe: 00.0 Host bridge: Intel Corporation Xeon 5600 Series QuickPath Architecture generic Non-core records (rev 02)
    Fe: 00.1 Host bridge: Intel Corporation Xeon 5600 Series QuickPath Architecture system address Decoder (rev 02)
    Fe: 02,0 Host bridge: Intel Corporation Xeon 5600 Series QPI Link 0 (rev 02)
    Fe: 02.1 Host bridge: Intel Corporation Xeon 5600 Series physical QPI 0 (rev 02)
    Fe: 02.2 Host bridge: Intel Corporation Xeon 5600 Series Mirror Port link 0 (rev 02)
    Fe: 02.3 Host bridge: Intel Corporation Xeon 5600 Series mirror Port link 1 (rev 02)
    Fe: 02.4 Host bridge: Intel Corporation Xeon 5600 Series QPI Link 1 (rev 02)
    Fe: 02.5 Host bridge: Intel Corporation Xeon 5600 Series physical QPI 1 (rev 02)
    Fe: 03.0 Host bridge: Intel Corporation Xeon 5600 Series Integrated Memory Controller Registers (rev 02)
    Fe: 03.1 Host bridge: Intel Corporation Xeon 5600 Series Memory Controller target address decoder built-in (rev 02)
    Fe: 03.2 Host bridge: Intel Corporation Xeon 5600 Series Integrated Memory Controller RAS Registers (rev 02)
    Fe: 03.4 Host bridge: Intel Corporation Xeon 5600 Series integrated Memory Controller Test Registers (rev 02)
    Fe: 04.0 Host bridge: Intel Corporation Xeon 5600 Series memory controller channel 0 control integrated (rev 02)
    Fe: 04.1 Host bridge: Intel Corporation Xeon 5600 Series integrated controller channel 0 address memory (rev 02)
    Fe: 04.2 Host bridge: Intel Corporation Xeon 5600 Series integrated memory controller 0 (rev 02) grade channel
    Fe: 04.3 Host bridge: Intel Corporation Xeon 5600 Series integrated memory controller channel 0 control thermal (rev 02)
    Fe: 05.0 Host bridge: Intel Corporation Xeon 5600 Series integrated controller channel 1 controls memory (rev 02)
    Fe: 05.1 Host bridge: Intel Corporation Xeon 5600 Series integrated controller channel 1 (rev 02) memory address
    Fe: 05.2 Host bridge: Intel Corporation Xeon 5600 Series integrated memory controller channel 1 row (rev 02)
    Fe: 05.3 Host bridge: Intel Corporation Xeon 5600 Series integrated memory controller channel 1 control thermal (rev 02)
    Fe: 06.0 Host bridge: Intel Corporation Xeon 5600 Series integrated controller channel 2 controls memory (rev 02)
    Fe: 06.1 Host bridge: Intel Corporation Xeon 5600 Series integrated controller channel 2 (rev 02) memory address
    Fe: 06.2 Host bridge: Intel Corporation Xeon 5600 Series integrated memory controller channel 2 rank (rev 02)
    Fe: 06.3 Host bridge: Intel Corporation Xeon 5600 Series integrated memory controller channel 2 controls thermal (rev 02)

    ------------------------------------------------------------------------------------------------

    So, one of the components seems to be "00:07.0 PCI bridge: Intel Corporation 5520/5500 / X 58 hub of e/s PCI Express Root Port 7 (rev 13)", but I'm not clear as to what this component is
    and what it connects too. Crack, "a fatal bus was detected on an element at location 1." seems too vague. What is slot 1 in this case?

    My questions are:

    What components apply to critical errors?

    I have to do things in the following order:

    -Unplug the power cord and hold it for 20 seconds
    -Firmware updates
    -Try reinstalling components
    -Replace parts

    PS. I'm no longer under warranty

    Thank you

    Dave

    Hello

    Location 1 must reference slot PCie 1. It is very likely the slot in which the PERC controller is. Your order of troubleshooting is correct. If it's the only occurrence, resettlement and the firmware update are probably enough.

  • Receiver 907 cod invalid after UpdateJad on the main application and library

    Hello world

    To distribute my BlackBerry live app (OTA) in the past, I would pack my main application, MyApp, and package a linked library application, MyLibrary, containing the main application resources separately.  I then copy the JAD/COD in demand for library files in the same directory as the JAD/COD of the main application files and run UpdateJad.exe on MyApp.jad and MyLibrary.jad.  At this point, I would download all the files on my web server (with the correct .htaccess file) and I could download my application on devices without problem.

    It was some time ago (one or two years).  Now, I'm updating my app and try to do it again.  However, I noticed that when I have my main application, Eclipse generates files JAD/COD for BOTH the application of the library AND the main application in the same directory of the main project of the application (deliverables > Web > 7.1.0).)  I don't think what happened in the past.  This directory contains now:

    • COD for MyApp files
    • Files of COD to MyLibrary
    • MyApp.jad
    • MyLibrary.jad
    • MyApp_full.jad (I don't remember this being produced in the past, either)

    Now, I tried to download my application in several ways, and each way gives an invalid "907 COD: error

    • Download the generated directory-is (and trying to download MyApp.jad AND MyApp_full.jad)
    • UpdateJad.exe running on MyApp.jad and MyLibrary.jad
    • UpdateJad.exe running on MyApp_full.jad and MyLibrary.jad
    • Only copies files from the generated directory MyApp and combining them into a new directory with the generated files to the separate project MyLibrary, packed (and UpdateJad.exe running on MyApp.jad and MyLibrary.jad)
    • etc... I tried practically all combinations.

    But nothing works!  However, if I install the application via MyApp.alx via BlackBerry Desktop Manager, it works.  Anyone know what could be going on here?

    Thank you!

    Hi peterstrange,

    I think I solved the problem.  I realized that I had problems downloading files on my Web server over the last two days with my standard FTP clients.  Once I downloaded the JAD/COD files to another web server, the download and the installation worked without problem (using MyApp_full.jad).

    I appreciate your prompt response to help!

  • Best practices with regard to adding list SkinnablePopUp from the main application file from A Mobile

    Hello

    I want to display a SkinnablePopUp when the user presses the back key when the current view is the first view to ask if he wants to quit.

    Logic (check if the key pressed is the previous key & & the current view is the first) is in the main file of the application and if these two conditions are true, then the exit() method is called.

    I want to show the confirmation popup. Can I move everything in the first pane view mxml or is - it OK to instantiate the SkinnablePopUp in the main application file?

    Thank you.

    its probably best to do principal in the view

    using mvc or mvp you would hold a script to a minimum in sight, just inject the presenter

  • Calling a function in the main sequence of a loaded swf file

    I know this is probably a very basic question, but I loaded a SWF file in another film. Now, I want to call a function in the main SWF file. Is it possible to do? Otherwise, I have a custom class where I could put the function, but I was not able to understand how to call it from the SWF loaded either. Can I somehow associate the class with the main movie, or...?

    Nevermind - I did something very stupid and was not calling the function as a method of a clip. I was just calling checkTarget (event) and not event.currentTarget.checkTarget (event); that seems to work.

  • Use the MC button to perform function on the main timeline

    I was wondering how (or if it is possible) to use a button that I have in a clip to perform a function on the main timeline. Specifically, I want the button in the clip to stop on an image of the main timeline. Any suggestions?

    Hello
    _root is the main scenario.
    So if you have your button (say button1) the code would be

    Button1.onRelease = function() {}
    _root.gotoAndStop (20);
    }

    This would prevent the main timeline to frame 20.
    This is for actionscript 2 (flash 8).

    for cs3 (actionscript 3) this would be it

    Button1.addEventListener (MouseEvent.Click, clickHandler);
    function clickHandler(event:MouseEvent):void {}
    _root.gotoAndStop (20);
    }

    Hope this helps
    Alan

  • Is the main application "placement?"

    I'm working on a login / my request timeout article. It works very well where clicking on the person of a connection box if they are inactive, but I can't seem to get the application to recognize activities. I am trying to register for these events, but they do not seem to work.

    The main application is always the scene? Something like:
    public void initApp(): void {}
    If (stage! = null)
    {
    stage.addEventListener (MouseEvent.MOUSE_MOVE, handleUserActivity);
    stage.addEventListener (MouseEvent.CLICK, handleUserActivity);
    stage.addEventListener (KeyboardEvent.KEY_DOWN, handleUserActivity);
    }
    }

    The scene must be non-null when the applicationComplete event is dispatched, so try:

    TS

  • Set the main application of labels preloader

    Hello

    Is there a way to change the label on the main application preloader that says "Loading" and "init"?

    Thank you.

    Yes it was!

    It is not easy to see.

    Thank you!!!

  • The main Application of loading and unloading component

    I want to load in my main application 2 components. Right now I have load with this:

    < components: loadProject id = "loadPrj" visible = "false" click = "loadPrj_clickHandler (event)" red = horizontalCenter '7' = "0" / > "

    and I put only visible to true. Inside this component, there is a canvas.

    But is there another way to do it using a class AS file? I want to load/unload on click, not only the value true or false visible.

    You might miss the import instructions.  Code hinting will offer classes

    that you have not imported.

  • Question of the main application class

    Hey people out there!

    A happy Friday to all just a quick question. The class that contains the main Sub public static in the BlackBerry application method, this class should be one that extends UiApplication or can the main method call the class that is responsible for this?

    Thank you!

    Schalk

    You can try something like that.

    class Test
    {
        public static void main(String args[])
        {
            Xyz xyz = new Xyz();
            xyz.enterEventDispatcher();
        }
    }
    ---------------------
    
    class Xyz extends UiApplication
    {
        Xyz()
        {
            pushScreen(new MainScreen());
        }
    }
    
  • Go to a function on the main timeline of the timeline of the object

    Hello

    I have an object on the stage, MovieClip, with an animation inside.

    The animation is called from a class file.

    I would like to call for a function, addBubbles, when the animation of the MovieClip is completed.

    The function, addBubbles, is described in the main timeline, in the first picture.

    But I would like to call from inside this MovieClip, and write the code in the last image.

    How should I reference, so it would work?

    Both ways would be to use just...

    MovieClip (root) .addBubbles ();   OR MovieClip (parent) .addBubbles ();

    Another way would be to have the MovieClip to dispatch a custom event for which you have a listener assigned in the main timeline.  This listener in the main storyline would have an event handler function that calls the addBubbles function.

  • How to remove a function on the main timeline in a clip

    How to remove a function which is coded on an image of the main timeline of a clip?  I tried this, but no dice:

    infoGraphicDisparity.addEventListener (MouseEvent.CLICK, fl_ClickToGoToScene);

    function fl_ClickToGoToScene(event:MouseEvent):void

    {

    parent.removeEventListener (Event.ENTER_FRAME, parent ["enterFrameHandler"]);

    MovieClip (this.root) .gotoAndPlay ("disparity");

    }

    It's the event that I am trying to remove:

    stage.addEventListener (Event.ENTER_FRAME, enterFrameHandler);

    any help would be appreciated as always.

    Thank you!

    any image (which runs after enterFrameHandler is defined) in any display in the display list object

    stage.removeEventListener (Event.ENTER_FRAME, MovieClip (root) .enterFrameHandler);

Maybe you are looking for