Dispatch text between mxml components

Hi all,
i was just trying to pass some string to an mxml component
and i have been having a hard time i am relatively new to flex and
what i want to do is simply pass a user id string to this component
in order to retrieve data specific to this user can someone help me
out?
Thanks a lot. : )

Simple declare the namespace where the file is located and create an instance of the component in the primary app.
If in the same folder as the main app MXML file:
xmlns:comp="*"    where comp can be anything (myComponents, components, etc.)
If a sub-folder "components" of the main app MXML file:
xmlns:comp="components.*"    where comp can be anything (myComponents, components, etc.)
<comp:MyFancyComponent id="myComp"/>    declare an instance of the component.
Then do this:
myAppVar = myComp.myCompVar;

Similar Messages

  • Data between mxml components

    I have a question about data between mxml components.
    Product.mxml is the overview screen for the products and ProductDetail.mxml (it is a TitleWindow) the detail screen.
    In the Product I define a value object ProductVo with all the data. When I click a record in the overview and click the button 'change' (changeProduct function) then a popup window appears with all the data in it.
    Code in Product.mxml:
    [Bindable]
    public var myWin:ProductDatail;
    private function changeProduct():void {
      myWin = PopUpManager.createPopUp(this, ProductDetail, true) as ProductDetail;
      myWin["btnSave"].addEventListener("click", save);
    private function save(event:Event):void {
      productVo.productId = myWin.ti_productnr.text;
      productVo.name = myWin.ti_name.text;
      productVo.ean = myWin.ti_ean.text;
      ...some code to save the data in the db...
    Code in ProductDetail.mxml:
    [Bindable]
    public var productDetailVo:ProductVo;
        <mx:Form>
            <mx:FormItem label="Productnr" required="true">
                <mx:TextInput id="ti_productnr" text="{productDetailVo.productId}" width="60"/>
            </mx:FormItem>
            <mx:FormItem label="Naam" required="true">
                <mx:TextInput id="ti_name" text="{productDetailVo.name}" width="200"/>
            </mx:FormItem>
            <mx:FormItem label="Ean">
                <mx:TextInput id="ti_ean" text="{productDetailVo.ean}" width="100"/>
            </mx:FormItem>
            <mx:FormItem direction="horizontal">
                <mx:Button id="btnSave" label="Save"/>
            </mx:FormItem>
        </mx:Form>
    So my question: the save function in Product.mxml, is it possible to do this in a easier way instead of linking all the data from the form into the value object? Something like productVo = myWin.productDetailVo, but that does not work.

    I just looked at the parsley framework and saw this code:
    private function save():void
    contact.firstName = firstName.text;
    contact.lastName = lastName.text;
    contact.email = email.text;
    service.save(contact);
    So, it is doing the same thing I'm doing.
    I'm using Spring and hibernate on the server level, it is my own framework.

  • [svn:fx-3.x] 11192: In AIR, you can drag' n drop text between text components like TextInput and TextArea.

    Revision: 11192
    Author:   [email protected]
    Date:     2009-10-27 12:54:37 -0700 (Tue, 27 Oct 2009)
    Log Message:
    In AIR, you can drag'n drop text between text components like TextInput and TextArea.  There's an AIR bug where doing so doesn't result in a TEXT_INPUT or a CHANGE event.  This is a workaround for that bug so that we listen for a nativeDragDrop event.
    QE notes: -
    Doc notes: -
    Bugs: SDK-19816
    Reviewer: Gordon
    Tests run: checkintests, mustella TextInput, TextArea
    Is noteworthy for integration: no
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-19816
    Modified Paths:
        flex/sdk/branches/3.x/frameworks/projects/framework/src/mx/controls/TextArea.as
        flex/sdk/branches/3.x/frameworks/projects/framework/src/mx/controls/TextInput.as

    First 3 .as are the component
    source. in the last test.mxml file i have written the drag and drop functionality.
    can any help me?? please

  • Best method for passing data between nested components

    I have a fairly good sized Flex application (if it was
    stuffed all into one file--which it used to be--it would be about
    3-4k lines of code). I have since started breaking it up into
    components and abstracting logic to make it easier to write,
    manage, and develop.
    The biggest thing that I'm running into is figuring out a way
    to pass data between components. Now, I know how to write and use
    custom events, so that you dispatch events up the chain of
    components, but it seems like that only works one way (bottom-up).
    I also know how to make public variables/functions inside the
    component and then the caller can just assign that variable or call
    that function.
    Let's say that I have the following chain of components:
    Component A
    --Component B
    -- -- Component C
    -- -- -- Component D
    What is the best way to pass data between A and D (in both
    directions)?
    If I use an event to pass from D to A, it seems as though I
    have to write event code in each of the components and do the
    bubbling up manually. What I'm really stuck on though, is how to
    get data from A to D.
    I have a remote object in Component A that goes out and gets
    some data from the server, and most all of the other components all
    rely on whatever was returned -- so what is the best way to be able
    to "share" data between all components? I don't want to have to
    pass a variable through B and C just so that D can get it, but I
    also don't want to make D go and request the information itself. B
    and C might not need the data, so it seems stupid to have to make
    it be aware of it.
    Any ideas? I hope that my explanation is clear enough...
    Thanks.
    -Jake

    Peter (or anyone else)...
    To take this example to the next (albeit parallel) level, how
    would you go about creating a class that will let you just
    capture/dispatch local data changes? Following along my original
    example (Components A-D),let's say that we have this component
    architecture:
    Component A
    --Component B
    -- -- Component C
    -- -- -- Component D
    -- -- Component E
    -- -- Comonnent F
    How would we go about creating a dispatch scheme for getting
    data between Component C and E/F? Maybe in Component C the user
    picks a username from a combo box. That selection will drive some
    changes in Component E (like triggering a new screen to appear
    based on the user). There are no remote methods at play with this
    example, just a simple update of a username that's all contained
    within the Flex app.
    I tried mimicking the technique that we used for the
    RemoteObject methods, but things are a bit different this time
    around because we're not making a trip to the server. I just want
    to be able to register Component E to listen for an event that
    would indicate that some data has changed.
    Now, once again, I know that I can bubble that information up
    to A and then back down to E, but that's sloppy... There has to be
    a similar approach to broadcasting events across the entire
    application, right?
    Here's what I started to come up with so far:
    [Event(name="selectUsername", type="CustomEvent")]
    public class LocalData extends EventDispatcher
    private static var _self:LocalData;
    // Constructor
    public function LocalData() {
    // ?? does anything go here ??
    // Returns the singleton instance of this class.
    public static function getInstance():LocalData {
    if( _self == null ) {
    _self = new LocalData();
    return _self;
    // public method that can be called to dispatch the event.
    public static function selectUsername(userObj:Object):void {
    dispatchEvent(new CustomEvent(userObj, "selectUsername"));
    Then, in the component that wants to dispatch the event, we
    do this:
    LocalData.selectUsername([some object]);
    And in the component that wants to listen for the event:
    LocalData.getInstance().addEventListener("selectUsername",
    selectUsername_Result);
    public function selectUsername_Result(e:CustomEvent):void {
    // handle results here
    The problem with this is that when I go to compile it, it
    doesn't like my use of "dispatchEvent" inside that public static
    method. Tells me, "Call to possibly undefined method
    "dispatchEvent". Huh? Why would it be undefined?
    Does it make sense with where I'm going?
    Any help is greatly appreciated.
    Thanks!
    -Jacob

  • Can Partial Trigger Work between Two Components Which Are in Two Pages?

    Scenario: Some output text components in page one while a SelectOneChoice and a InlineFrame are in page two. At first the resource attribute of inlineFrame was set to point to page one. When changing the value of SelectOneChoice, the values of those output text will be expected to change accordingly. I tried to make SelectOneChoice to be the trigger of those output text components, but found that SelectOneChoice can't be seen when attempt to edit the value of PartialTrigger attribute of those output text components. Then I tried to set the ID of SelectOneChoice as the value of the InlineFrame component, but failed getting the wanted result again.
    Problem: How to get a partial refreshing effect between two components that are in two different pages? Can partial trigger work in this scenario?
    Thanks for your interest!

    Hi,
    Sorry, you can't achieve that the way you're doing it. If you're using 11g, however, you could do that using regions.
    Regards,
    ~ Simon

  • Dynamically add custom MXML components in Actionscript

    As there's no constructor for custom MXML components, how to
    dynamically add it as a child using ActionScript?
    I'm looking for some alternative to avoid the need to rewrite
    the entire existent component in ActionScript just to add it this
    feature (a constructor). PopManager is not an alternative...
    Is there any way?
    The case/situation:
    I have a custom MXML component that needs to be dinamically
    added to a NativeWindow created using ActionScript.
    Thanks a lot!
    Vicente Junior
    Independent Web Developer
    http://teclandoalto.blogspot.com

    mxml classes get generated into AS classes with a default
    constructor.
    In fact, there is essentially no difference between an AS
    component and an mxml component, they can be used exactly the same
    way.
    Tracy

  • Architecting an Application With MXML Components

    I have an application that has gotten lengthy and I want to
    simplify it by architecting the Main Application with custom MXML
    Components. The application as it is currently architected works
    perfectly.
    Currently, the application consists of "Canvas" containers
    along Top and Left Side holding Navigation Buttons. The main
    (changing) sections of the application will consist of a
    "ViewStack" container holding a number of "Canvas" containers
    stacked on top of one another. The navigation buttons along the top
    and left side, when clicked, display in turn the content of each of
    the several stacked "Canvas" containers. Because of the number of
    stacked "Canvas" containers within the "ViewStack" and the content
    of each, the main Application source code has become very long and
    unwieldy, thus the need to use custom components for each of the
    "Canvas" containers in the "Stack" and referencing them in the main
    Application page.
    I have tried several times to get this to work and I need to
    clarify a couple of things.
    1) After setting up custom components for the several
    "Canvas" containers that are now in the "ViewStack" container, do I
    first need to set up a custom component for the "ViewStack"
    container with its own name space?
    2) If the answer to 1) above is Yes then do I then reference
    each of the custom components for the "Canvas" container with their
    own name space designation within the "ViewStack" reference within
    the main Application?
    In the event I am completely off base then I would appreciate
    any suggestions. If you wish I would be happy to email you the
    current application page.
    Thanks,
    Joe
    joe k

    Here is some code for an app built with components. You can
    see how the pieces talk to each other a bit.
    ------------------------- ViewStack1.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns:comp="components.*"
    layout="vertical" width="100%" height="100%" >
    <comp:TopBar />
    <mx:HBox width="100%" height="100%">
    <comp:LeftBar />
    <mx:VBox width="100%" height="100%">
    <mx:ViewStack id="myViewStack" borderStyle="none"
    width="100%" height="100%">
    <mx:VBox id="home" width="100%">
    <comp:MainIntroText />
    <mx:HRule width="50%" height="3"
    strokeColor="0xCC3333"/>
    <comp:MainSecondaryText />
    <mx:HRule width="50%" height="3"
    strokeColor="0xCC3333"/>
    <comp:MainFinalText />
    </mx:VBox>
    <mx:VBox id="about" width="100%">
    <comp:About />
    </mx:VBox>
    <mx:VBox id="contact" width="100%">
    <comp:Contact />
    </mx:VBox>
    </mx:ViewStack>
    </mx:VBox>
    </mx:HBox>
    </mx:Application>
    ------------------------------- About.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:HBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="100%">
    <mx:VBox width="65%">
    <mx:Text fontSize="14" width="100%" text="This page tells
    you about us." />
    </mx:VBox>
    </mx:HBox>
    ----------------------------------- Contact.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:HBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="100%">
    <mx:VBox width="65%">
    <mx:Text fontSize="14" width="100%" text="This page tells
    you how to contact us." />
    </mx:VBox>
    </mx:HBox>
    ------------------- LeftBar.mxml -------------------------
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="200" height="100%">
    <mx:LinkButton label="Adobe Labs - Flex"
    click="navigateToURL(new URLRequest('
    http://labs.adobe.com/technologies/flex'),
    '_blank');"/>
    <mx:Spacer height="20"/>
    <mx:Label fontSize="16" text="Flex Blogs"/>
    <mx:LinkBar direction="vertical" width="90%"
    itemClick="navigateToURL(new URLRequest(event.item.data),
    '_blank');">
    <mx:Object label="Adobe Flex Team Blog" data="
    http://weblogs.macromedia.com/flexteam/"/>
    <mx:Object label="Flex Blog Aggregator" data="
    http://www.allyourflexarebelongtous.com/"/>
    <mx:Object label="Adobe Flex Blog Aggregator" data="
    http://weblogs.macromedia.com/mxna/index.cfm?query=byCategory&#38;categoryId=5&#38;categor yName=Flex"/>
    </mx:LinkBar>
    <mx:Spacer height="20"/>
    <mx:Label fontSize="16" text="Example Flex Apps"/>
    <mx:LinkBar direction="vertical" id="addlRscList"
    width="90%" itemClick="navigateToURL(new
    URLRequest(event.item.data), '_blank');">
    <mx:Object label="Adobe Flex Store" data="
    http://www.adobe.com/devnet/flex/samples/flex_store_v2/"/>
    <mx:Object label="Adobe Dashboard Example" data="
    http://examples.adobe.com/flex2/inproduct/sdk/dashboard/dashboard.html"/>
    <mx:Object label="Buzzword Word Processor" data="
    http://preview.getbuzzword.com/?s=true"/>
    <mx:Object label="Adobe Style Explorer" data="
    http://examples.adobe.com/flex2/consulting/styleexplorer/Flex2StyleExplorer.html"/>
    <mx:Object label="Adobe Component Explorer" data="
    http://examples.adobe.com/flex2/inproduct/sdk/explorer/explorer.html"/>
    </mx:LinkBar>
    </mx:VBox>
    ----------------------- MainFinalText.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="100%">
    <mx:Text width="100%" fontSize="12"
    text="Here is the final text I want to show you." />
    </mx:VBox>
    --------------------------- MainIntroText.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="100%">
    <mx:Text width="100%" fontSize="12"
    text="Here is the main text I want to show you." />
    </mx:VBox>
    ----------------------- MainSecondaryText.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="100%">
    <mx:Text width="100%" fontSize="12"
    text="Here is the secondary text I want to show you." />
    </mx:VBox>
    --------------- TopBar.mxml --------------------------------
    <?xml version="1.0" encoding="utf-8"?>
    <mx:HBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="100%">
    <mx:Script>
    <![CDATA[
    private function goToViews(view:String):void {
    if(view == "home"){
    this.parentApplication.myViewStack.selectedChild=this.parentApplication.home;
    if(view == "about"){
    this.parentApplication.myViewStack.selectedChild=this.parentApplication.about;
    if(view == "contact"){
    this.parentApplication.myViewStack.selectedChild=this.parentApplication.contact;
    ]]>
    </mx:Script>
    <mx:LinkButton label="MySnazzyLogo" fontSize="20"
    click="goToViews('home');" />
    <mx:VBox width="100%">
    <mx:HBox width="100%">
    <mx:Spacer width="100%" />
    <mx:LinkBar fontSize="14"
    itemClick="goToViews(String(event.item.data));">
    <mx:Array>
    <mx:Object label="About Us" data="about"/>
    <mx:Object label="Contact Us" data="contact"/>
    </mx:Array>
    </mx:LinkBar>
    </mx:HBox>
    <mx:HBox width="100%">
    <mx:Spacer width="150" />
    <mx:Label fontSize="25" text="Here is Some Additional
    Text" />
    </mx:HBox>
    </mx:VBox>
    </mx:HBox>

  • How data transfered between two components in FPM. - SRM Shoppingcart

    Hi Guys,
                   I have requirement for SRM Shoppingcart.. to add new column in /SAPSRM/WDC_UI_SC_DOTC_BD (Item Overview Table)  component and to populate the data from this column into /SAPSRM/WDC_DODC_NA (Item Details Tabs) component Notes and attachment text column. (View - V_DODC_NOTES)
    I dont find any component usage or Link between these components.
    Application - /SAPSRM/WDA_L_FPM_OIF
    Could you please provide the outline of what has to been to transfer data between the two components.
    This is an enhancement to std. SAP shopping cart process. - Is this enhancement possible ?
    Cheers
    Sam
    Edited by: samraj001 on Dec 7, 2010 4:47 AM

    Hi,
    Can you resolvre these problem.. I have the same situation.. If you can resolveit, can you helpme??
    Thanks...!!!  

  • I have three iPhones on one iTunes account.  Evere since upgrading to ios5 the text between them is screwed up.  Anyone have this problem or know how to fix?

    All of the text between them are screwed up.  They cannot text  just one.  The text goes to and comes from each.  Very annoying. Please help

    Is it actually texting that is the issue or iMessage?
    If it's iMessage... then you need a unique iCloud ID for each device otherwise it will do exactly what you are experiencing.

  • The linked text boxes are very important to my work flow. Not being able to flow text between pages has cost me a lot of valuable time in producing my newsletter. Any ideas?

    In Pages 09 I was able to flow text between text boxes on the same page and to different pages but that seems to have gone away. This is one of the most useful items in Pages that I use. Now it seems to have gone away and I could find no replacement in doing my last newsletter, (which took at least 3 times as long to produce.) I am very disappointed in Pages 13 so far and look for some bright side to this software to change my opinion.

    Apple has promised to bring back *some* features "within six montha." We're 4 months into the clock. They have brought back a couple of features (ability to cutomize the toolbar, for instance, and vertical ruler). But they still have a long way to go and there is no certainty that linked text boxes will be restroed. It wasn't cited in their original list of examples  of what would be brought back. (Nor was mail merge, bookmarks, Applescript support, or many other items.)

  • Is there a way to delete text between two strings?

    In Pages, is there a way to delete all text containted between two strings?
    For example, if I have a text document that looks like this:
    String 1
    String 2
    Unwanted text
    Unwanted text
    String 3
    String 4
    Is there was to delete the unwanted text between string 2 and 3 so it looks like this:
    String 1
    String 2
    String 3
    String 4
    The unwanted text is differnet between documents but string 2 and 3 are constant. I want to do this via automator for the same strings on multiple documents.
    Any help is appreciated!

    Do you mean Pages '09 v4.3?
    There were some links here:
    https://discussions.apple.com/message/24051199#24051199
    Peter

  • Converting MXML Components to ActionScript Classes

    I'm in the process of converting most (if not all) of my MXML
    components to Action Script classes. I've found this is easy, and
    doesn't require a lot of extra code when extending a simple
    container or control. However, several of my MXML components have
    several nested containers and controls - i.e. a component that
    contains several Labels, a ComboBox, a TextInput, a Button, and a
    DataGrid, plus several other containers needed for layout. To code
    the layout of all these containers and controls using MXML, it uses
    about 16 lines of code. To code the layout in ActionScript, it
    takes about 50+ lines of code (see attached).
    I'm just wondering if there are any best practices for
    creating ActionScript classes that include several (or even A LOT
    OF) containers and controls. It's very easy to layout in MXML, and
    is more visibly pleasing to look at and understand, but I feel it
    is best practice to code components as ActionScript classes. I know
    I should be using MVC, but it's a little late to rewrite the entire
    application now.
    Any thoughts?

    I can't specifically speak to how to write layout code in
    ActionScript, but you can look at the generated code that Flex
    creates to get an idea of how Flex does it. When you compile an
    app, the Flex compiler takes your MXML input and converts it to
    ActionScript classes before compiling the entire set of classes
    into a SWF. Because of this, you can look at the interim
    ActionScript code.
    You do this by setting the keep-generated-actionscript
    compiler option to true and looking in the /generated directory.
    hth,
    matt horn
    flex docs

  • Printing Text between boxes in sapscript

    Hi Friend ,
    I have a invoice form . There is the adddress window , info window and the main window . I need to insert some text between the space between the MAIN window and the INFO window . Is there a way we can directly print text between Window or Do i need to create a new window ?? How can I go about this . I have already defined the text in SO10 transaction . I am using this command but dont know how to put it in the space between the infowindow and the main window . Please suggest .
    INCLUDE Z_text_insert  OBJECT TEXT ID ST LANGUAGE SP PARAGRAPH HP.
    Thank you ,
    Hari
    Message was edited by:
            Hari G Krishna

    Ya u have to insert a  window between the two windows.Any text to be printed should be in window.
    Check and let me know if u face any problem.
    Regards

  • Safari 4 won't render all text between pre and /pre tags

    I am unable to read text between <pre> and </pre> tags in Safari 4.0.3 for Snow Leopard. The problem started when I upgraded to Snow Leopard, but I'm afraid I might have corrupted something when I ran a piece of nastiness called Leopard Cache Cleaner that also corrupted some other preferences. I tried deleting .com.safari.plist to no avail. Anyone heard of this problem or have a solution?

    I found the solution - it turns out that Safari's "fixed width" font was supposed to be Courier, but for some reason Courier wasn't loading properly. Setting another Fixed width font fixed the problem.

  • Flex mxml components should be private by default

    Flex mxml components should be private by default. Does adobe
    plan to fix this in future versions?

    Just noticed this and I think he may have a valid point here.
    But as well as reducing coupling the term I'd use to make this
    argument is
    encapsulation.
    There's no way AFAIK to make MXML sub components invisible to
    higher level components. This can sometimes reveal things
    internally that you don't want messed with, within a custom
    component. If you have a custom component that only requires
    one property be set to configure it properly, you don't want
    to be revealing all these extra sub-components just because they
    had to have ids assigned to them inside the custom component.
    This may be a headache for backwards compatibility, for
    anyone who has assumed these components would be public by default,
    but a simple "scope='public'" attribute should fix that. But even
    having them public by default, and allowing us to set their scope
    to private would be helpful at times.

Maybe you are looking for