Mxml tag map to AS function

How to do that? I can only map to public vars but i want to
map to i function.
For example i want to create a custom actionscript component
with a button in it, and when i create this component in mxml to
change the label of the button like this
<comp:myCustomComp myFunction=myFunction("change
label")/>
Should i use setters and getters with a public var to change
the label?

Yes. Use getter setter then when you have the following the
setter / getter functions are used:
setter function executed
<comp:myCustomComp id="myComp" label="Here is New Label
Text"/>
getter function executed
<mx:Text text={myComp.label}/>

Similar Messages

  • Can I use variables in mxml tags?

    I want to control a lot of details in a layout.  I need to use variables to do this.  Of course I can use AS.  Is there a way to do it in the MXML tags?  See the code below.  I can do the "myLine.x = lineX" in AS.  But is there something like:  x="{lineX}" to use in a tag?  (This gives a warning, though it does work.)  It would make life faster if I could...   Is there a "right" way to do this?
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                   initialize="init()" >
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <fx:Script>
            <![CDATA[
                internal var lineX:Number = 25;
                private function init():void {
                    myLine.x = lineX + 50;       
            ]]>
        </fx:Script>
        <s:Line id="myLine" xFrom="0" xTo="0" yFrom="50" yTo="300" >
            <s:stroke>
                <s:SolidColorStroke color="0x0000ff" weight="2" />
            </s:stroke>
        </s:Line>
        <s:Line id="myOtherLine" x="{lineX}" xFrom="0" xTo="0" yFrom="50" yTo="300" >
            <s:stroke>
                <s:SolidColorStroke color="0xff0000" weight="2" />
            </s:stroke>
        </s:Line>
    </s:Application>

    Hmm, thanks, that's very useful to know.
    I guess that means I should use AS.  It's not something I need to update often.  Rather, I have a whole bunch of groups of components/graphics that I want to line up based on each other--and when I change my mind about the size or position of one thing (possibly inside a container a level or two), I'd like to be able to just change one variable name rather than have to change them all by hand.  But AS can do it just fine.

  • Event handlers:  click in mxml tags or in AS?

    Is there an advantage to putting click event handlers in AS rather than in the mxml tags?  For example
    in AS
    button_1.addEventListenter(MouseEvent.CLICK, someFunctionName);
    or in mxml tags
    <s:Button click="someHandlerName(event) />
    Thanks

    I will say that there is another advantage to MXML.
    For instance, say that I have a static function I want to run any time you click a component and don't care about the event. I can do this in MXML:
    <s:Whatever>
    click="{doMyStaticMethod()}"
    </s:Whatever>
    In AS, I cannot do this. A click event in AS requires that I add an ActionListener and that the ActionListener be void and take an event. MXML gives a way around that if you like.

  • Manipulating mxml tags (view) in Cairngorm.

    i have a cairngorm based app that consists of a tabnavigator
    with 8 tabs. i need to set the visibility of tabs through app
    initialization as well as through user gestures.
    what's the best way to accomplish this? i have a function
    that toggles tabs as i see fit; however, i need the
    tabnavigators(view) id from the mxml tag. i can't get this to work.
    besides, it's not the best practice to reference a view like that
    through a command class, is it?
    thanks in advance...
    fd

    No worries.
    Also, be sure to read the Cairngorm series of articles by
    Steven Webster in the ADOBE DEVELOPER CONNECTION site, if you
    haven't already done so:
    http://www.adobe.com/devnet/flex/articles/cairngorm_pt1.html
    http://www.adobe.com/devnet/flex/articles/cairngorm_pt2.html
    http://www.adobe.com/devnet/flex/articles/cairngorm_pt3.html
    http://www.adobe.com/devnet/flex/articles/cairngorm_pt4.html
    http://www.adobe.com/devnet/flex/articles/cairngorm_pt5.html
    http://www.adobe.com/devnet/flex/articles/cairngorm_pt6.html
    Happy holidays !

  • Google Maps buttons not functioning

    Google Maps does not function anymore in Safari. None of the buttons work, including the search button (I can type in an address, but nothing happens when I press the mag. glass icon, or return), or any of the smaller icons in the corner including zoom in/out, help, tools etc.
    Works just fine using Firefox, and I did update Flash to the latest version.
    Any help appreciated--thanks in advance.

    From the Safari menu bar, select
              Safari ▹ Preferences... ▹ Extensions
    Turn all extensions OFF and test. If the problem is resolved, turn extensions back ON and then disable them one or a few at a time until you find the culprit.

  • Custom AS3 Component / Event Definition for MXML Tag

    Custom AS3 Component / Event Definition for MXML Tag
    Exposing custom event in custom MXML tag.
    I have made an AS3 custom component named,
    'CustomListComponent'.
    Is a list type component extending UIComponent.
    When an item is clicked (selected) I generate a custom event
    named, 'selChange'
    I want the user to be able to use this tag, define a handler
    on the MXML tag.
    I tried using metadata like [Event("selChange")] in the
    component AS3 file with no luck.
    Any help / examples to expose a custom event from an AS3
    custom component to the MXML tag for the end user/developer would
    help significantly.
    Anyone? Thank you.

    Well, That did not take long.
    My mistake, Typo type.
    [Event(nane="selChange", type="flash.events.Event")]
    That is: naNe not naMe :(
    Thank you all for your time and responses.
    I WILL check my code more closely next time I post a
    question.
    P.S.: @VarioPegged : My code is big and not needed now. If
    you would like it anyway just message me. TY

  • [svn] 1153: ASDoc: minor correction to default style value in MXML tag syntax

    Revision: 1153
    Author: [email protected]
    Date: 2008-04-08 15:36:58 -0700 (Tue, 08 Apr 2008)
    Log Message:
    ASDoc: minor correction to default style value in MXML tag syntax
    Modified Paths:
    flex/sdk/branches/3.0.x/frameworks/projects/framework/src/mx/controls/ComboBox.as

    Running the script by python2 solves it for me:
    su - mythtv -c "nice -n 19 python2 /usr/bin/tv_grab_nl_py --output ~/listings.xml"
    Best regards,
    Cedric

  • Is there a way to overload the Map's toString() function?

    Hello everyone. I was wondering if its possible to overload the toString() function of the Map datastructure supplied by java.
    I looked it up and it says:
    public class HashMapextends AbstractMapSo I looked up AbstractMap and it says:
    public abstract class AbstractMapextends Objectimplements MapAnd I found a toString() function in the AbstractMap saying:
    toString
    public String toString() Returns a string representation of this map. The string representation consists of a list of key-value mappings in the order returned by the map's entrySet view's iterator, enclosed in braces ("{}"). Adjacent mappings are separated by the characters ", " (comma and space). Each key-value mapping is rendered as the key followed by an equals sign ("=") followed by the associated value. Keys and values are converted to strings as by String.valueOf(Object). This implementation creates an empty string buffer, appends a left brace, and iterates over the map's entrySet view, appending the string representation of each map.entry in turn. After appending each entry except the last, the string ", " is appended. Finally a right brace is appended. A string is obtained from the stringbuffer, and returned.
    here: http://java.sun.com/j2se/1.3/docs/a...ml#toString()So I did the following:
    package parse;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.List;
    import java.util.Map;
    import java.util.Set;
    import java.io.*;
    //this class should store all the Messages or "Events" and
    //you can access them based on their EntityID key.
    public class MessageDB extends HashMap
         //database to hold the information
         //     holds the Alerts/messages
         public static Map<Integer, List<String>> AlertMap;
         //Constructor
         MessageDB()
              AlertMap = new HashMap<Integer, List<String>>();
         public String toString()
              return ( )//not sure what to put here...
         //print, outputs the contents of the hashMap
         public static void print()
            //want to print out the Key and all the Messages
              //associated with that key
              Set keys = AlertMap.keySet();          // The set of keys in the map.
              Iterator keyIter = keys.iterator();
              System.out.println("The map contains the following associations:");
              while (keyIter.hasNext()) {
                    Object key = keyIter.next();  // Get the next key.
                    Object value = AlertMap.get(key);  // Get the value for that key.
                    System.out.println( "EntityID: " + key + "\n"
                                  + "Message: " + value + "\n" );
         //overloaded print to print to user screen.
         public static void print(PrintWriter out)
              //want to print out the Key and all the Messages
              //associated with that key
              Set keys = AlertMap.keySet();          // The set of keys in the map.
              Iterator keyIter = keys.iterator();
              out.println("The map contains the following associations:");
              out.flush();
              while (keyIter.hasNext()) {
                    Object key = keyIter.next();  // Get the next key.
                    Object value = AlertMap.get(key);  // Get the value for that key.
                   //out.flush();
                   /* out.println( "   (" + key + "," + value + ")" );
                   out.flush();*/
                   // out.println("------------------\n");
                   out.println("EntityID: " + key + "\n"
                                  + "Message: " + value + "\n");
                   //out.println("------------------\n");
                   out.flush();
         void add(Message msg)
              //getting the position of the List by EntityID if avaiable
              List<String> Alert = AlertMap.get(msg.entityID);
              //checking to see if there is a unique Key already in the Map.
              if (Alert == null)
                   //if there isnt a key in the map, add a new key, and a new List mapping
                   //to the key EntityID;
                     Alert = new ArrayList<String>();
                     AlertMap.put(msg.entityID, Alert);
                     Alert.add(msg.message);
              else
              //adding message to List
                   Alert.add(msg.message);
    }Right now the output is like this:
    The map contains the following associations:
    EntityID: 99999
                      Message: [a test ]
    EntityID: 800
                    Message: [this is a test , again a test ]
    EntityID: 801
                    Message: [again a test ]
    EntityID: 111
                    Message: [a test again yes , a test once again ]You see how its automatically doing [message1, message2,...,message x]
    By me calling this line of code:
    out.println("EntityID: " + key + "\n"
                                  + "Message: " + value + "\n");Because I found out it implicity calls the toString() method when concatinating it to a string.
    What I would like it to display would be:
    EntityID: 800
    Message:
    This is a test
    This is a test again
    any ideas would be great!
    Or is there a way to just iterate over the messages, rather than doing it my way?
    Message was edited by:
    lokie

    Hi,
    When you do a String concatenation in java, calls are implicitly done to #toString().
    Means, you are doing this:
    while (keyIter.hasNext()) {
                    Object key = keyIter.next();  /
                    Object value = AlertMap.get(key); 
                    System.out.println( "EntityID: " + key.toString()+ "\n"
                                  + "Message: " + value.toString() + "\n" );
    }The "[ [/b]... [b], ... , ... ]" you can see in your output is created by the implicit call to List#toString() method.
    You can Override it in an anonymous class by doing:
    if (Alert == null)
                   //if there isnt a key in the map, add a new key, and a new List mapping
                   //to the key EntityID;
                     Alert = new ArrayList<String>(){
                              @Override
                               public String toString(){
                                StringBuilder sb = new StringBuilder();
                       for(String s: this){
                        sb.append(s);
                        sb.append("\n");
                               return sb.toString();
                             };PS:
    toString() is usually used for debbuging only...

  • XML File - Problem.with naming tags with XI standard functions

    Hello,
    simple (?) problem:
    Receiver expects an XML file via file adapter.
    (The source data comes from an RFC connect to XI.)
    In the XML tags like these are expected (following W3C definitions):
    A)   </gdt:ValueGroup>
    How to define a data type with a ":" in its name or to convert it to the required tag?
    B)   <gdt:ExtendedAttribute gdt:guid="4c102d6b077de7c1f0e27391e40bb80f" gdt:code="X01" >GR2 LI3</gdt:ExtendedAttribute>
    This one is a real nice one. The part with "gtd:guid=" within the tag is variable. How to add such values into tag names?
    Any ideas if this is possible with standard and how.
    If this is the limit of XI I think we need an XSLT- or JAVA-maping program to generate the required file.
    Thank you for any help!
    Best regards
    Dirk

    Hi Dirk,
    just one thing:
    >>>>The part with "gtd:guid=" within the tag is variable.
    this is ok as it's just an attribute
    of the ExtendedAttribute tag's name
    so it can be variable without any problems
    (you can fill it in the mapping for example)
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Define Inbound Interface for Interface Mapping with Java functions

    Hi,
    we are developing an R/3-XI-ITK-SBO system. We realized our SOAP component as custom java functions and we installed it on ITK.
    We need to import and configure these functionality in XI because we need to reference to it when we define the Message Interface and the Interface Mapping in Integration Builder Design.
    Someone is able to tell us how we can import and configure these java function or definition in XI?
    Thanks in advance.
    Best regards.

    Hi,
    INBOUND:
    Step 1. EDI Subsystem creates an IDoc file from EDI Messages
    2. Subsystem calls Functional Module EDI_DATA_INCOMING from startRFC program.
    3. Data in Control Record is validate against the Partner Profile.
    4. IDoc is generated in Database and syntax check is carried out.
    5. IDoc file is deleted once file read.
    6. Event PROCESSSTATE REACHED is triggered in Idoc Object Workflow.
    7. Check for Process Immediately.
    If NO
    Execute RBDAPP01 Program
    Else
    Read Process Code from Partner Profile
    Process Code Points to Function Module
    Application Document Posted.
    further help:
    check url
    http://www.sappoint.com/abap/ale.pdf
    http://www.sappoint.com/abap/ale2.pdf
    http://www.sapgenie.com/ale/configuration.htm
    http://www.sappoint.com/abap/ale.pdf
    http://www.sappoint.com/abap/ale2.pdf
    http://www.sapdevelopment.co.uk/training

  • Performance of mapping containing a function call

    Hi,
    I have:
    SOURCE TABLE ------------------------------------------------- JOIN --------------- TARGET TABLE
    CONSTANT ----------------------- FUNCTION --------------------^
    The source table has an ID column and the function returns a P_ID which is selected from a control table. The join includes the clause; WHERE ID > P_ID - this restricts rows to later than a point in time and the P_ID is constant during the mapping's run.
    When I deploy this, it performs badly and, on examination, it appears that the function is being called for each row in the source table.
    Is it possible to set up the mapping so that P_ID is fetched once when the mapping starts and the value is re-used for the rest of the run? Would making the function deterministic help in this case?
    Regards
    Steve

    OK, thanks for all your help, guys.
    There seems to be two solutions depending on the contents of the function:
    1. When the function contains complex processing - Modify the premapping to return the single value. In my case, the current premapping stage maps to a generic premapping function so I will need to wrap it in a dedicated function that calls the generic function, then calls the function that returns the single value I want.
    2. If the functionality of the function is simple enough - in some of my cases it consists only of a select statement - bin the function in favour of the select itself and combine that into the mapping. The optimiser will then just drag the value I want in.
    Thanks for the input.
    Steve

  • Help in Mapping: User defined function

    Hi All, I need your help in doing the following mapping:
    The source contains the below fields:
    Source_MT -- Under this          1...1
       LineItem                                 1...Unbounded
         CompanyCode          1..1
         Amount               1..1
       SubTotal                               1...Unbounded
         CompanyCode          1...1
         Amount               1...1
    And the Target strunture should be:
    Target_MT -- Under this
       Target                               1...unbounded
         CompanyCode          1...1
         AmountMatched          1...1
    There will be multiple line items in the source for each compony code which I need to loop through and add the amounts. For a company code, The sum of the amounts in the line items should match with the amount in the Subtotal/Amount.
    For each company code, a target should be created with the result whther the amounts were matched or not.
    Below is the data example:
    Source:
    Line Item :
         CompanyCode          Amount
         ABC               5
         ABC               5
         XYZ               10
         ABC               7     
         XYZ               6
    Sub Total :
         CompanyCode          Amount
         ABC               17
         XYZ               5
    Target should be:
    CompanyCOde          Amount
    ABC               Matched
    XYZ               Not Matched
    Hope I am clear with my requirement. Please let me know if you need more clarity.
    I was able to create mapping, if the line items contains single company code. Need help with multiple company codes.
    Any help would be appreciated.
    Edited by: GP on Jan 29, 2008 5:55 PM
    Edited by: GP on Jan 29, 2008 5:57 PM

    I am still working on the same map (please refer above) for which you gave th3e solution. The solution almost worked.
    I need to validate the line items with the subtotals. If the validation fails, I should throw an custom exception. If the validation is successful, then do nothing (do not create the target element).
    Hope I am clear. Please let me know if I am not clear.
    LineItem1: 10
    LineItem2: 20
    SubTotal1: 30
    LineItem3: 5
    LineItem4: 5
    SubTotal2: 15
    In the above example, eventhough LineItem1 and LineItem2 sum up to Subtotal1,  LineItem3 and LineItem4 doesn't sum up to SubTotal2. So it should throw an exception because second validation failed.
    Also, it should not create target element because first validation was successful.
    I used the logic int he below link :
    [http://www.flickr.com/photo_zoom.gne?id=2229287904&size=o]
    In the "else" part of "If else" statement, I have a user defined function which throws exception.
    If the output is "true", I am avoiding creating the target element using "Createif" statement.
    But strangely, when the vaildation of first set fails (LineItem1, LineItem2 and Subtotal1), then it is throwing the exception.
    But when the validation of second set fails, then it is not throwing the exception.
    My current map looks like below:
    [http://www.flickr.com/photos/23389577@N02/2234471441/sizes/l/]
    Edited by: GP on Feb 1, 2008 6:46 PM
    Edited by: GP on Feb 1, 2008 6:50 PM
    Edited by: GP on Feb 1, 2008 7:01 PM

  • Message Mapping (user-defined function)

    Hi all,
    Is there anyway to determine the XML message ID using an user-defined function in Message Mapping? When I go to SXI_MONITOR I see that all messages have an unique ID, but I'm having some difficulties to understand if there is any way to get that ID in a message mapping and pass it to a target structure? I see that it is possible to use constants like "Sender" and "Receiver", but I haven't found anything for the message ID.
    Can you please help me?
    Thanks in advance.
    Regards,
    Ricardo Inácio

    Try this code..
    Create an UDF and do not pass any arguments to it..
    java.util.Map map;
    // get runtime constant map
    map = container.getTransformationParameters();
    // get value of header field by using variable key
    String msgid = (String) map.get(StreamTransformationConstants.MESSAGE_ID);
    return msgid;
    Now map this udf to your target field. Now test it....
    P.s. Since message id is run time property therefore in mapping test tab it will not work. Try it at runtime.
    Regards,
    Sarvesh

  • IDOC to FILE(xml) graphical mapping using node function createIf

    Greetings All,
                My Scenario is Idoc to File(XML)
    Target Structure is 
                           MO_MAT_LAN....................(0: unbound)
                                LAN_KEY.......................(0 :1)
                                DESCRIPTION.................(0 : 1)
    Source MATMAS Idoc
                           E1MAKTM.........................(0 : 99)
                                SPRAS_ISO..................(0 :1) 
                                MAKTX..........................(0 :1)
    initially i had mapped E1MAKTM----->MO_MAT_LAN but i dont want target node MO_MAT_LAN to be created when the SPRAS_ISO is equal to EN
    I have tried using node function createIf but the node is geting created only once although the input stucture is having occurance more than 5.
    Can anyone please help me to achive this.
    Many thanks,
    Rohit

    U have to use:-
    SPRAS_ISO mak the context to E1MAKTM compare (Use equals) it with Constant function EN out put to be given to If without else and in then Give E1MAKTM and map out put of If node to MO_MAT_LAN.
    chirag

  • Inconsistencies between an MXML tag instance's properties and an Actionscript instance's properties

    Hi everyone!  I've been using the SDK for several months, but I've only been using Flash Builder for a few weeks.  I finished the Flex In a Week videos and exercises a few days ago, and since then I've been playing around with the accompanying exercises.
    My question specifically refers to the PanelSkin.mxml file from 'Exercise 5.6: Creating custom skin properties'.  In this example, the function initTitleSkin() sets the 'headerSkinColor.color' property to a value passed from the main application:
    <?xml version="1.0" encoding="utf-8"?>
    <s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:s="library://ns.adobe.com/flex/spark"
        creationComplete="initTitleSkin()">
        <s:states>
            <s:State name="normal" />
            <s:State name="disabled" />
        </s:states>   
        <fx:Metadata>
                   [HostComponent("components.EmployeePortalPanel")]
       </fx:Metadata>
        <fx:Script>
            <![CDATA[
                private function initTitleSkin():void
                    headerSkinColor.color = hostComponent.panelTitleColor;
            ]]>
        </fx:Script>
    <s:Rect radiusX="4" radiusY="4" height="100%" width="100%" >
         <s:fill>
              <mx:SolidColor id="panelSkin" color="#E8E8E8"/>
          </s:fill>
    </s:Rect>
    <s:Path winding="nonZero" data="M 0.016 0.012 L 0.016 23.354 L 287.419 23.354 L 287.408 12.012 C 287.408 5.385 282.035 0.012 275.408 0.012 L 0.016 0.012 Z">
         <s:fill>
              <s:SolidColor id="headerSkinColor"/>
         </s:fill>
    </s:Path>
    <s:Label id="titleDisplay" lineBreak="explicit" left="10" right="4" top="2" height="30" verticalAlign="middle" fontWeight="bold"/>
    <s:Group id="contentGroup" top="23">
    </s:Group>
    </s:SparkSkin>
    This code works just fine.  I tried extending this example by setting the 'titleDisplay.color' property in the same way.  The 'titleDisplay' is an instance of the Label class.
         private function initTitleSkin():void
                    headerSkinColor.color = hostComponent.panelTitleColor;
                    titleDisplay.color = hostComponent.panelLabelColor;
    The above code results in the error 'Access of possibly undefined property color through a reference with static type spark.components:Label'.
    I set up the custom 'panelLabelColor' property and confirmed the 'hostComponent.panelLabelColor' property is being passed to the custom skin class correctly.  My question is, Why can I set the 'color' property in the MXML Label block, but not from the ActionScript instance.  The Language Reference shows the spark Label has a 'color' property.  Code Assist shows the 'color' property in the MXML block, but not in the ActionScript instance.  Am I missing something simple that's staring me right in the face?  I'm usually pretty good at that.  I'd appreciate any thoughts on this inconsistency.

    it's not likely.

Maybe you are looking for

  • Slow browsing, timeouts and pages failing to load

    Hi, Over the last few days we've been having browsing issues on multiple devices where pages are taking forever to load if at all. We're sometimes having to refresh the browser 3 or 4 times to get a page to load correctly. Sites like speedtest, once

  • Bcache setup advice wanted

    Hello World I have been tinkering with mine SDD-HDD setup with Bcache. And i was wondering if i did it right ??? Mine Idea was to have a 90GB SDD for quick root access. And use the rest of the SSD with Bcache to speedup files from the HDD. Any advice

  • Urgent:L regarding MM04 mass report

    hi, I had made dis report and it is working fine and ir is displaying some material correct and some of the material is not displaying correct. plzz help me out as help will be definately rewarded. REPORT ZNEW01 no standard page heading LINE-SIZE 310

  • [Solved by adding GQview]Is Feh not capable of opening svg files...?

    I have installed Feh from the community repos, along with imlib2. according to the official website, feh can open SVG files, but I get an error... feh WARNING: /home/jaydoc/archlinux-artwork-1.1/logos/archlinux-grad1-dark.svg - No Imlib2 loader for t

  • JDeveloper UI editor problems with inheritance (?!)

    Hi, I've created a superclass which extends JPanel and adds a setPanelBinding method, a getPanelBinding method and a member variable named panelBinding. This class looks similar to the dataPanel class BC4J provides but the set and get methods are pro