Access nested array element using this.name - is it possible?

Hi
I've got a nested array containing a series of 2 element arrays containing an object name, and text related to that object.
I've set it up like this:
public var names:Array = [["instance name 1", "text for first object"],["instance name 2", "text for second object"], ...]];
What I'm trying to do is to have the text related to the object appear in a text box when the object is moved.
This is all set up within a class containing code for the drag and drop functions.
If I set the text box to show a specific element, such as:
MovieClip(parent).text_box.text= names[2][1];
it works fine. But I can't get it to create the value for the first bracket from the this.name attribute.
I had it working for 2 arrays - one with the name and another with the text where the code was;
MovieClip(parent).text_box.text= texts[names.indexOf(this.name)];  (arrays named 'names' and 'texts', text box named 'text_box')
I'm hoping there's something similar that I can do for the nested array, but everything I try gives me the #1010 error - term undefined.
Is there an easy way to sort this out - or am I better sticking with the 2 array version?
(BTW this is my first go at using arrays)
Thanks

Why not use an Object for this, like:
var oTexts:Object = {
                              "clipname1":"text for clip 1",
                              "clipname2":"text for clip 2",
                              "clipname3":"text for clip 3",
and then jsut use sometihing like this
var txt:String = MovieClip(parent).oTexts[this.name];
etc. ..

Similar Messages

  • How to change value of array element using property node

    hello all : )
    im using an array of combo-box. the size of array is not fixed.
    i want to use the strings[ ] property of combo-box to enter selection texts but since i have placed it inside the array im unable to use this property.
    i used 'arrayelem' reference property and connected property node to it but didnt got strings [ ] in the selection.
    so is there any way i can use the strings [ ] property
    Solved!
    Go to Solution.

    the picture what I posted is a snippet. It is a png file which also contains a vi:
    http://www.ni.com/tutorial/9330/en/
    I have found this post. I am just reading it:
    http://forums.ni.com/t5/LabVIEW/combobox-in-array-why-does-it-work-this-way/m-p/2146916/highlight/tr...
    It might help...
    hmm, it is more complicated as I thought )
    edit: just to be CLEAR: so you want to create a new selection LIST for each of the array elements (comboboxes)) OR you just want to set all the comboboxes to a particular value which is ALREADY in the combobox list??

  • How to access an element using its name or id if it is not a class variable?

    I am trying to retrieve the element I added to my UI in a different  function. I am using actionscript 3. I know I can put the variable into a  class variable, so it can be access anywhere in the class, but I have  too many elements. Is there anyway I could access them without putting  them into class variable?
    Thanks.
    public class Test extends SkinnableContainer{
    // private var image:Image; <-- I try not to do this, too messy
    private function func1() {
        var image:Image = new Image();
        addElement(image);
    private function func2() {
        var image:Image = /* how to get the element from my UI without putting into class variable */

    Here is what works for me:
    <?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"
                   creationComplete="init()"
                   minWidth="955" minHeight="600">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import spark.components.Image;
                private var  image:Image;
                private function init():void
                    image = new Image();
                    addElement(image);
                    trace(this["image"]);
            ]]>
        </fx:Script>   
    </s:Application>

  • Binding to Array element using BindingUtils

    I have an arraycollection that would have (say) 5 elements in it. Then I have a component with a property that would need to bind with one of the elements in the array. Which element does it gets bound to, is determined at runtime by a function. How would I do that in Actionscript? I am stuck using the BindingUtils.....
    e.g.  I need to bind the dataProvider property of my component to arr[0] for one instance  and to  arr[4] for another instance.

    You may not be able to directly set the indexed value.
    Try some thing like this.
    Add a property that returns the indexed value.
    Ex. if you ArrayList objets are of type "String"
    int index = 5;
    public String getMyValue(){
    return w.get[index]
    Now your value binding would look something like
    #{SessionBean1.myValue}
    BTW, if you want to access different index, create another method
    public void setIndex(int index){
    this.index = index;
    - Winston
    http://blogs.sun.com/roller/page/winston?catname=Creator

  • Accessing multiple xml elements with same name

    I am having trouble with an xsl stylesheet. This is what one of the rows of my output xml document looks like
            <Row>
                <Num>1</Num>
                <Valuation>Val</Valuation>
                <COMBCHARFLAG>Y</COMBCHARFLAG>
                <CCCOUNT>2</CCCOUNT>
                <CCDESC>CHARDESC1</CCDESC>
                <CCDESC>CHARDESC2</CCDESC>
            </Row>
    Does anyone know how I can access the 2nd CCDESC ("CHARDESC2") . When i run this in the workbench I can only ever access the first CCDESC, it acts like the 2nd isn't there. However I was also using a 3rd party xsl editor called "XMLSpy" to look for other possible solutions and when i render it with XMLSpy, everything is displaying correctly. Is this some sort of limitation of the workbench? Any help would be much appreciated. Thanks
    This is the template i am calling in my xsl.......
    <xsl:template name="for.loop">
    <xsl:param name="i" />
    <xsl:param name="count" />
    <!--begin_: Line_by_Line_Output -->
    <xsl:if test="$i &lt;= $count">
    <tr>
         <td align="center"><xsl:value-of select="CCDESC[position()=$i]"/>
         </td>
         <td align="center">
              <input style="width:110px;" class="Mfieldv-M" name="txtValuation"></input>
         </td>
    </tr>     
    </xsl:if>
    <!begin_: RepeatTheLoopUntilFinished>
    <xsl:if test="$i &lt;= $count">
    <xsl:call-template name="for.loop">
    <xsl:with-param name="i">
    <xsl:value-of select="$i + 1"/>
    </xsl:with-param>
    <xsl:with-param name="count">
    <xsl:value-of select="$count"/>
    </xsl:with-param>
    </xsl:call-template>
    </xsl:if>
    I than call the template as follows from within my  <xsl:for-each select="Row"> statement
                                                                <xsl:call-template name="for.loop">
                                                                <xsl:with-param name="i">1</xsl:with-param>
                                                                <xsl:with-param name="count"><xsl:value-of select="CCCOUNT"/></xsl:with-param>
                                                                </xsl:call-template>

    Muzammil,
    Thanks for the response. I may have explained my situation a little poorly. I am not trying to access the 2nd CCDESC within the workbench via a repeater or such. It is after the XSL renders the page that I don't see the second CCDESC. When the XSL renders the page through Internet explorer i get something that looks like the following......
    Res # 1
    CHARDESC1 
    When I render it in the application XMLSpy it shows both CCDESC's like follows.
    Res # 1
    CHARDESC1 
    CHARDESC2
    In XMLSpy if i change the line of xsl code from      <td align="center"><xsl:value-of select="CCDESC[position()=$i]"/>  to       <td align="center"><xsl:value-of select="CCDESC[2]"/> the page is rendered in XMLSpy with both labels the same as follows.
    Res # 1
    CHARDESC2 
    CHARDESC2
    If i do that same change in the workbench and render the page through IE I get no label results....
    Res # 1
    Thanks

  • TF207012:You cannot save this query with this name because another query that uses this name is already open.

    Hi,
    I am developing a custom control in TFS2012 using c#. The custom control is a button, when I click it in UI, the current work item will be saved in the next state.
    But if I new a workitem using the button and save it using "save work item" button after changing something, I always get an error called TF207012. After I close the error message, the workitem has been saved.
    How can I removed this error message?
    Any help will be apperciated.Thanks.

    Hi Aodixius,
    For this issue, you might check whether you have defect in your custom control. Generelly, you may also need to custom a web control for team web access after customizing for Visual Studio. About custom control for TFS work item, check the links below for
    more information and make sure your custom control works.
    https://witcustomcontrols.codeplex.com/
    http://blogs.msdn.com/b/greggboer/archive/2010/03/30/work-item-tracking-custom-controls.aspx
    http://blogs.msdn.com/b/narend/archive/2006/10/02/how-to-use-custom-controls-in-work-item-form.aspx
    Best 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.

  • Extract array elements using plsql

    I have an XMLTYPE variable containing the following SOAP envelope:
    <?xml version="1.0" encoding="US-ASCII"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
    <soapenv:Body>
    <ns1:cleanseAddressResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:dbCleanseSoapBinding">
    <ns1:cleanseAddressReturn xsi:type="soapenc:Array" soapenc:arrayType="ns2:string[5]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://www.w3.org/2001/XMLSchema">
    <item>1369 S 325 E STE 2323</item>
    <item/>
    <item>BOUNTIFUL</item>
    <item>UT</item>
    <item>84010</item>
    </ns1:cleanseAddressReturn>
    </ns1:cleanseAddressResponse>
    </soapenv:Body>
    </soapenv:Envelope>
    How can I extract individual values of ITEM using PLSQL? I can't seem to be able to extract anything out of this without raising ORA-30625 "method dispatch on NULL SELF argument is disallowed"

    You can create XMLSEQUENCE() from the extract() function and they get the value out.
    Or you can use the //item[1]/text() //item[2]/text().
    Does this make sense to you?

  • How do I access array elements in one method from another method?

    Hi all!
    How do I access the array's elements from another method so that method 2 can have access to method 1's array elements? Thanks for any help!
    I am trying to create a simply program that will use a method to create an array and a SEPARATE method that will sort the array's elements (without using java's built in array features). I can create the program by simply having one method and sorting the array within that same method, BUT I want to sort the array from another method.
    Here's my code so far:
    public class ArraySort {
       public static void createArray(int size){
           double myArray[] = new double[size];    //create my new array
           for(int j=0; j < myArray.length; j++)
              myArray[j] = (200.0 * Math.random() + 1.0);   //fill the array with random numbers
       public static void sortArray(){
           // I WANT THIS METHOD TO ACCESS THE ARRAY ELEMENTS IN THE METHOD ABOVE, BUT DON'T KNOW
          //  HOW???? Please help!
        public static void main(String[] args) {
            createArray(4);    //call to create the array
    }Thanks again!
    - Johnny

    Thanks for the help all! I ve managed to get the program working, using java's built in array sort, but when i try to call on the array sort method from WITHIN my main method, nothing happens!
    Can somebody please tell me why I am not able to call on the sort method from within my main class???? Thanks!
    public class ArraySort {
       public void createArray(double[] arrayName, int size){
           double myArray[] = new double[size];  //create new array
           for(int j=0; j < myArray.length; j++)
              myArray[j] = (200.0 * Math.random() + 1.0);    //populate array with
           }                                                 //random Numbers
           sortArray(myArray); 
       } //Sort array(if I delete this & try to use it in Main method --> doesn't work???
       public void sortArray(double[] arrayName){
           DecimalFormat time = new DecimalFormat("0.00");
           Arrays.sort(arrayName);      //sort array using Java's built in array method
           for(int i = 0; i <arrayName.length; i++)
               System.out.println(time.format(arrayName)); //print arary elements
    public static void main(String[] args) {
    ArraySort newArray = new ArraySort(); //create a new instance
    double myArray[] = new double[0]; //create a new double array
    newArray.createArray(myArray,4); //build the array of indicated size
    //newArray.sortArray(myArray); //This will not work???? WHY?????//

  • How can I access the selected element of a DropDownByIndex-box?

    Hi,
    I want to create a WebDynpro with two web services. I created the first request with the first web service and the results are displayed in a DropDownByIndex-Box. Now the user should choose one of the results and I would like to use this for the request with my second web service. How can I access the selected Element of a DropDownByIndexBox in the Code?
    Thank you!!
    Julia

    Hi Julia,
    when user select one element in drop down it automatically set lead selection of node binded to dropdown.
    For example if you bind a dropdown to node myNode with value attribute myAttribute the lead selection of node myNode is set in the position of element choose from user.
    So to take this chooised element use this code:
    wdContext.currentMyNodeElement.getmyAttribute()
    bye
    Andrea

  • Atomic operation on array elements

    For array elements of primitive types (32 bits and less): byte, short, int. Are array operations atomic?
    For example, define byte b[] = new byte[1];
    thread A executes b[0]++; thread B reads b[0]. or both threads writing..
    Question:
    1 Is it possible to get an incostintent value reading b[0].
    2. Do you think JVM or OS know that two threads work on the same element and synchronizes them to ensure value consistency?
    As a consequence of synchronizatrion, is there speed difference if I have two threads writing to b[0] and b[1] OR two threads writing to same element b[0]. I checked, there seems to be none.

    Suppose I do not want to synchronize access to array
    elements. Then you can't guarantee correct behavior of things like ++.
    It's going degrade performanceHave you measured this, so that you know it will be a problem, or are you just assuming?
    but would
    like to understand whether JVM enforces the same
    atomic rule on array elements as does with variables.++ is NOT atomic on anything--variables or array elements. All threading issues are the same for array elements as for variables.
    Can anynody comment on performance? Is it faster to
    modify different elements of array versus the same
    index? shouldn't the same be slower?Try it yourself and see if you can even see a meaningful difference.

  • Reference using the name assigned with setName

    I am automatically generating a data update screen that displays labels
    and associated data fields. The labels and fields are generated based on the field names and types contained in a SQL table. As the fields are generated the field name is set to the name of the field in the SQL table.
    For example:
    decimalData = new LimitedDecimalField(currentDoubleValue,  columnsAllowed, minDoubleValue, maxDoubleValue);
    decimalData.setName(((Vector)fieldInfo.elementAt(i)).elementAt(1).toString());Normally I have a reference to the field that I need to set or get a value from.
    But in some cases I also have total fields that need to be updated. I am
    only able to identify the name of the field (the one set using the setName() function).
    Is there some manner I can use this name to set ot get the associated field value?
    Thanks for any suggestions
    rykk

    Is it possible to check (process) the form (component) hierarchy to identify the field?

  • Use Table Name in Summary Table

    Hi,
    I am looking for a way to use the names of tables in another table.
    eq. I have tables named after the months. And I want to use this name in another table in which i summarize all the facts from the mont tables. Is there a way to refer to the table name?
    Thanks in Advance Paul

    Hi Jerrold
    It seems that we made the same interpretation.
    I just wished to give a soluce allowing the user to change easily the name of the referenced table.
    In my sample, if I add a new table, the required task is just to add it's name in the first column and replicate the original formula with no change.
    For a single formula, it changes quite nothing but if we use many cells, it's an efficient time saving.
    I just gave a really bare example.
    Here is one with more referenced cells.
    Don't worry, the separator is semi-colon because I ran Numbers in English on my French system
    Yvan KOENIG (VALLAURIS, France.) mardi 11 août 2009 17:19:46

  • This.name and application.name different?

    Hello,
    how come that, within the application.cfc file, this.name and application.name are different?
    Shouldn't this.name be inherited by the application? Isn't that confusing?
    Thanks for clarification

    If I recall correctly, you use this.name to set your application name in Application.cfc, and Application.applicationName to read it in other files. Application.name is just a variable you've created in the Application scope.
    Dave Watts, CTO, Fig Leaf Software
    http://www.figleaf.com/
    http://training.figleaf.com/

  • Nested IPE (In Place Element) usage when accessing Cluster/Array data via DVR

    I am sharing data across several VIs and loops via a DVR, and accessing the data via a DVR IPE. The data is a cluster of arrays. The diagram below (VI attached) illustrates the structures invloved, but not the structure of the application.
    (The diagram above does not include initialization of the arrays, as it is intended only to illustrate the Cluster1 data type. Array lengths could be 100.)
    The DVR (DVR1) is passed to multiple VIs of the application at startup.
    Each VI executes loops that either read or write particular elements of each array (fArray1 or fArray2).
    I believe the DVR IPE (B1-DVR) provides blocking so that only one task can modify the data (Cluster1) at any time.
    Case 1 illustrates how I currently WRITE to array elements. The outer IPE (block B1) is rolled into a VI (not shown) that takes DVR1, Index, and Value as inputs.
    Cases 2 - 4 illustrate 3 additional methods that remove one or both of the inner IPEs (B2-Cluster and B3-Array).
    Case 2: IPE B3 (Array Index/Replace Elements) is replaced with a non-IPE 'Replace Array Subset'.'
    Case 3: IPE B2 (Unbundle / Bundle Elemnts)' is replaced with a non-IPE cluster 'Unbundle'/'Bundle'.
    Case 4: removes both B2 and B3.
    I implemented case 1 a long time ago.  When I had to do the same thing again recently, I did case 4.  When I stumbled across my earlier implementation, I was a bit suprised
    Which of the 4 cases should take the least time (or resources) to execute? I think case 4 has as few array allocations as any of the other 3.
    The attached image did not capture the Buffer Allocation marks, so I marked the ones that differed with a red "B".
    I am only interested in differences in how the arrays are handled, so I see no signioficant differences.
    Is this one of those cases where LV doesn't need my help?
    Incidently, I recently wrote a small app with shared data and decided to try FGVs to share array data.  For small arrays, 10^7 iterations, and an FGV based array-element read followed by a element write, the FGV was faster.  1.2us per read/write for FGV vs 3us per r/w for an DVR/IPE based read/write (like above).
    Peter
    LV 2011 SP1, Windows 7 64-Bit
    Attachments:
    IPE.vi ‏9 KB

    Option 1 is a definite no and as far as I know it has been NI's explicit intention to steer clear from it. I believe there's an idea in the IE which asks for this.
    I agree that option 2 makes sense, but I don't think it should be something the user specifies. Either LV can detect it automatically or it can't, but I doubt NI would let you have an option which creates the possibility for this kind of bug.
    I'm not sure, but the mark as modifier option on the IPES might be the option you're looking for. I know that it exists and I know very roughly what it does, but the documentation for it is very limited and I never actually played around with it, as usually I don't need these kinds of optimizations.
    You may well be right that a new option on the IPES is desirable and you should probably add it to the idea exchange.
    As for NIWeek, I'm not going this year, so I have no idea what kinds of sessions are around, but it's a great place to find people who know what they're talking about and ask them about it directly. Certain people in LV R&D would probably be ideal for this and if you ask relevant people, you might even get their names. I'm sure buying them a beer would also help to loosen their tounges. If you ask me, this type of interaction is the main value of the conference, not the sessions themselves.
    Try to take over the world!

  • How to use XSLT for mapping feild names one by one to array element

    I have a XSLT case to map all the attributes feild name(not value) which has no child to the target, which is array loop.
    I give an sample below.
    source:
    <Items xmlns="http://www.example.org/sample">
    <SourceSystem>SourceSystem2573</SourceSystem>
    <TimeStamp>2010-01-17T20:54:08.234</TimeStamp>
    <Item>
    <ID>2574</ID>
    <Type>2575</Type>
    <Name>2576</Name>
    </Item>
    </Items>
    source XSD like:
         <element name="Items" type="tns:ItemsType"></element>
         <complexType name="ItemsType">
              <sequence>
                   <element name="SourceSystem" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
                   <element name="TimeStamp" type="dateTime" maxOccurs="1"
                        minOccurs="1">
                   </element>
                   <element name="Item" type="tns:ItemType"
                        maxOccurs="unbounded" minOccurs="1">
                   </element>
    </sequence>
         </complexType>
    <complexType name="ItemType">
              <sequence>
                   <element name="ID" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
                   <element name="Type" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
    <element name="Name" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
    </sequence>
         </complexType>
    target need to be like:
    <ns1:AttributesCollection>
    <ns1:Attributes>
    <ns1:fieldname>SourceSystem</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>TimeStamp</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>ID</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>Type</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>Name</ns1:fieldname>
    </ns1:Attributes>
    </ns1:AttributesCollection>
    target XSD:
    <xs:element name="AttributesCollection" type="AttributesCollection"/>
    <xs:complexType name="AttributesCollection">
    <xs:sequence>
    <xs:element name="Attributes" type="Attributes" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="Attributes">
    <xs:sequence>
    <xs:element name="fieldname" minOccurs="0">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="100"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    I know we can use local-name() to get the tag/field name,
    but I have not idea how to get these leaf field names one by one and then mapping to every array elements.
    I tried whole day but no successful
    Does anyone have some idea?
    Thanks very much!
    Keith
    Edited by: user1065212 on 17-Jan-2010 22:50
    Edited by: user1065212 on 17-Jan-2010 22:53
    Edited by: user1065212 on 17-Jan-2010 22:59

    can you paste source xsd and the correct xml output, the current one isn't really valid
    <ID>2574</TotalNumOfItems>

Maybe you are looking for