How Do I Convert a String that Names an Object to a Reference to the Object

You get many program-specific object names in the XML that is returned by describeType.  Suppose I find an object that interests me.  What is the best way to convert the String that names the object (e.g. the id of the object) to a reference variable that points to the object? 

Sure.  I am working on a complex application that involves several ViewStacks, several Accordions, some checkboxes, some radio buttons, some text boxes.  These components are scattered about, but all are children of a base class that is successfully enumerated by
var classInfo:XML = describeType(vwstk);
Suppose I write a loop as follows:
 for each (var a:XML in classInfo..accessor){
Inside that loop I have a series of tests like
if (a.@type == "mx.controls::CheckBox"{
Then, I iterate thru all of the children of the base class as in:
for  
(var u:Object in vwstk)
{        if  
Inside the if I persist the checked/not checked status of the checkbox.
The tricky part is going from the string a.@name to the Object reference u.  I doubt my proposed method will work.  Do you have a better idea?

Similar Messages

  • How can I convert a string to a seperated characters?

    How can I convert a string to a separated characters without using array?
    such as: input = String "word"
    output =
    w
    o
    r
    d
    Thanks

    A string is stored internally in individual characters.
    The String class has a method 'charAt(int index)' which returns the character at that index so using a for loop..
    String s = "word";
    for(int counter=0; counter < s.length(); counter++)
    System.out.println(s.charAt(counter));
    HTH

  • How do I convert files so that I can play music on my android phone?

    I am unable to play any of the music that I bought or uploaded through itunes on my Samsung phone.
    How do I convert these files?
    Major pain!

    Hello PowerPhill, & welcome to the boards. I think it's great your creating widgets & think that you should chek these sites out!
    The first is an App, I'm sure you know abouit Widget maker & may help with your problem?
    The second two are places to upload your widgets to ResExcellence & Widget Developer ...on the last site click on "Upload Your Widgets" for both Yahoo & Dashboard.
    http://www.widgetfactor.com/
    http://www.resexcellence.com/upload/
    http://www.widgetdeveloper.com/gallery.php
    PS I also found this article I hope this helps
    http://developer.apple.com/documentation/AppleApplications/Conceptual/Dashboard_ ProgTopics/Articles/Delivery.html

  • How Do i create a list that will show in a dropdown box with the list being pulled from another tab and not the cell data format junk?

    How Do i create a list that will show in a dropdown box with the list being pulled from another tab and not the cell data format junk?
    I currently run OS X 10.10.1
    Now i have been trying to work on this for a while now and what i want to do should be simple but its apparently not.
    Here is an example of what i want to happen.
    I will have 2 tabs: Contact | Sales
    Now Contacts will have the list of names and various information about a customer, While Sales will have one drop-down box for each Cell Row that will show the names of the person in tab contacts
    for what i am wanting to do i cant use the data format pop-up menu because the list is edited everyday several times a day.
    Now how do i do this, Excel can do this so how can numbers do it?

    Hi Shegra,
    Paste this into a applescript editor window and run it from there. In the script you may need to adjust the four properties to agree with your spreadsheet. Let me know if you have any questions.
    quinn
    Script starts:
    -- This script converts column A in one table into an alphabetized list of popups. It copies the last cell in that column. Then reverts the column to text. It then refreshes popups in column A of a data table starting with a user defined row.
    property DataEntrySheet : "Sheet 1" --name of sheet with popups to be refreshed
    property DataEntryTable : "Sales" --name of table with popups to be refreshed
    set copyRange to {}
    property PopValueSheet : "Sheet 1" --name of sheet with popup values table
    property PopValueTable : "Contacts" --name of table with popup values
    set PopStartRow to {}
    tell application "Numbers"
      set d to front document
      set ps to d's sheet PopValueSheet
      set pt to ps's table PopValueTable
      set s to d's sheet DataEntrySheet
      set t to s's table DataEntryTable
      set tf to t's filtered --this records filter setting on data Entry Table
      display dialog "Start from row #..." default answer "" with icon 1 -- with icon file "Path:to:my.icon.icns" --a Week # row
      set PopStartRow to {text returned of result}
      tell pt --convert list to alphabetized popups
      set ptRows to count rows
      set copyRange to ("A2:" & name of cell ptRows of column "A")
      set selection range to range copyRange
      set selection range's format to text
      sort by column 1 direction ascending
      set selection range's format to pop up menu
      -- popupsmade
      set selection range to cell ptRows of column 1 of pt
      set v to value of cell ptRows of pt
      end tell
      activate application "Numbers"
      tell application "System Events" to keystroke "c" using command down
      tell pt
      set selection range to range copyRange
      set selection range's format to text
      end tell
      tell t
      set filtered to false
      set tRows to count rows
      set pasteRange to ((name of cell PopStartRow of column "A") & ":" & (name of cell tRows of column "A"))
      set selection range to range pasteRange
      tell application "System Events" to keystroke "v" using command down
      set filtered to tf
      end tell
    end tell

  • How do I convert an excel (2008) document to Numbers?  When I drag the Excel document onto the Numbers icon I get, "Import error.  The file format is invalid"

    How can I convert an Excel (2008) document to Numbers.  When I drag the Excel document onto the Numbers icon I get, "Import error.  The file format is invalid.

    That extension identifies the most current Excel file format, a format that can be opened by Numbers '09 (and by Numbers '08).
    A check with Numbers '09 shows it capable of opening .xlsx files when right-clicked (and Numbers chose as the application to open, when double-clicked (if Numbers has been set as the default application to open this type of file, or when dragged to the Numbers icon in the dock.
    I see two possibilities for Numbers inability to open it and the message you receive:
    1. The file is not actually an Excel file, and the sender has added the .xlsx extension to the filename manually.
    2. The file is an Excel file, but has somehow been corrupted.
    Have you tried opening the file with a different application? The open source Office suites, OpenOffice.org, LibreOffice and NeoOffice can also open .xlsx files. If they're unable to open this one, that would point toward the file itself being faulty. You can download these applications from their rspective websites, linked in the names above. All request a donation to support future development, but only Neo requires one to have been made recently, and that only for the current release (which won't be necessary to open .xlsx files).
    Regards,
    Barry

  • How do I convert a .pub file into a PDF, 2 page spread without the dotted line down the center?  I can select 2 page view and cover page in 2 page view, but the dotted line shows up.  Thank you!!

    How do I convert a .pub file into a PDF, 2 page spread without the dotted line down the center?  I can select 2 page view and cover page in 2 page view, but the dotted line shows up.  Thank you!!

    Hi skt102711,
    I would like to inform you that acrobat doesn't support .epub to .pdf format conversion. Please browse this Link for more information : Supported file formats | Acrobat, Reader
    Regards,
    Rahul

  • How can I convert a layer into a smart object with Adobe Photoshop Elements 10?

    How can I convert a layer into a smart object with Adobe Photoshop Elements 10?

    That feature is only in PS. Elements as you buy it has only limited support for smart objects. If you use File>Place to add something to your image it will come in as a smart object (within the limits to which PSE understands smart layers). However, if you know someone who can write an action for you in PS you can install it in PSE, or you could look into something like elements+ from simplephotoshop.com.

  • I have a new computer and have all my music is on an external hard drive.  I have the external hard drive connected to my computer.  How do I get my music that is on my ipod to go to the itunes on the new computer.

    I have a new computer and have all my music is on an external hard drive.  I have the external hard drive connected to my computer.  How do I get my music that is on my ipod to go to the itunes on the new computer.

    What error message are you getting when you try to launch iTunes? (Precise text, please.)

  • How can I send a file that CAN NOT be printed or saved by the recipient?

    How can I send a file that CAN NOT be printed or saved by the recipient?

    Impossible. PDF files don't stream, so they cannot be opened until they've been saved.
    You can truly prevent printing by using DRM, or ask nicely by using a permissions password (though that's ignored by non-Adobe software).

  • How do I convert emails to PDF from Outlook to make a file on the PC?

    how do I convert emails to PDF from Outlook to make a file on the PC

    It is always tough for anyone when we need to save our emails into one file for future reference. You could either do it manually or can use a simple tool to Convert all your messages into one pdf file . This Single pdf file can be used if we need to read any past email. you can easily convert oulook to pdf in no time. If you are converting several email messages, you can either save them as separate files with initial layout fully intact or combine them into one big PDF document.

  • How do i finish a download that was already started and not finished because the library closed befo

    how do i finish a download that was already started and not finished because the library closed before it done

    What are you trying to download and how were you downloading it?

  • How can I convert a string to an object or class

    I would like to read a file representing a class, and convert it to an object or a class (object preferred). Other postings suggest using javax.tools.JavaCompiler to convert from a string but then say that this is not always available (posting on 1 Jan 09). If this is still not universally available is there another way to do this? If this is not available, are there any examples of how it should be done?
    My understanding from what I've read is to read the file into a String then compile the String using javax.tools.JavaCompiler, which is an Interface.
    thanks

    skidmarks wrote:
    What i would like to do is to take a Java file representing a class and compile it at runtime. However, the comment about a JDK being available at runtime makes this unattractive.So, you want to compile .java files, but you don't want to have to use a compiler?
    The next guess would to be to create a .jar file and reference it at runtime. Here's the scenario:Eh? How is that even remotely equivalent?
    1. People using the 'system' will have a varied knowledge of Java.
    2. My hope was to require that anyone using the program would only need to create a Java Class file,You mean a Java source file. You have said that YOU want to create the .class file. If they are creating the .class file, then all you need to do is load it with a ClassLoader and start using it.
    You might try clarifying your requirements a bit.
    In either case, the Class Files would look like:
    public class Name {
    int field1;
    float field2;
    } With all the field types being simple Java Primitives.What is the point of this? What are you ultimately trying to accomplish, that can be served by user-defined groups of primitives, with no complex object graphs and no user-defined methods?
    Depending on what you're really getting at, using scripting features via beanshell, groovy, or javascript might be an approach to consider, or using Scala to produce a domain-specific language (although I suspect that last may be overkill, and beyond your current skill level).
    If this is so, is there any way to create a .jar file at runtime? Do I have to exec("jar") or is there another way.A .jar file is just a .zip file with a manifest. Look at the java.util.jar package. But note that creating a .jar file has nothing to do with the rest of what you're asking about.

  • How do I tranform a string that was strored in binary/hex in SQL back to hex/binary to store it in another location

    I have a local database where the password is stored as binary for security.  I do not want the original.  I need to be able to restore a person's password if they don't login for a long time (two onths or more...the system deletes their password). 
    If I store the binary/hex password by name, I should be able restore the hex/binary to the table and they can login.  How do I convert the string back to a hex value to set into the tble again ?

    I have a local database where the password is stored as binary for security. 
    That's not secure, never store passwords, use (store) only hash (+salt) values for compare:
    http://en.wikipedia.org/wiki/Cryptographic_hash_function
    http://en.wikipedia.org/wiki/Salt_(cryptography)
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • How do I convert a string into a decimal

    I've been tryin to convert a string into decimal but I can't get it to work at all. I keep getting an exception.
    I've tried all of these:
    double myDouble = Double.valueOf(string).doubleValue();
    int myint = Interger.parseInt(string);
    float myfloat = Float.parseFloat(string);
    I can't get anything to work.
    That string i'm reading in is an array containing values with decimals. ex: -45.09348
    All the above work fine if there is no decimal, but fails when it comes to one.
    How do I go about doing this?
    Thanks!

    This works for me:String s = "-45.6789";
    double d = Double.parseDouble(s);
    System.out.println(d);Mark

  • How do I convert a string, and use a string as a property?

    I have an array in the following format:
    {ownsCar: 'true', ownsBike: 'true', ownsHouse: 'true'}
    {ownsCar: 'false', ownsBike: 'true', ownsHouse: 'true'}
    {ownsCar: 'true', ownsBike: 'false', ownsHouse: 'true'}
    etc ............
    And I need to test against each item e.g.
    if...
    myDataGrid[myItem].ownsCar == Object(myCheckbox).label
    ... then
    if...
    myDataGrid[myItem].ownsBike == Object(myCheckbox).label
    ... then
    if...
    myDataGrid[myItem].ownsHouse == Object(myCheckbox).label
    ... then
    But I need to build my application where the property (e.g. "ownsCar", "ownsBike", "ownsHouse") is a variable such as:
    if...
    myDataGrid[myItem].myProperty == Object(myCheckbox).label
    ... then
    I would like to loop through my Array, counting the number of items, and then use each item as a property.
    How would I convert the string (e.g. "ownsCar") into a property "myProperty" ???
    Many thanks in advance
    Chris

    Thanks, but my problem is that I won't know what my property will be.
    E.g. they could be...
    {svnsdkvnsdklvnsdklv: 'true', seuAfnwfnw: 'true', asfwseionf: 'true', etc.................}
    and there could be lots of them.
    I need to have myObject[N], where N is a variable property for each of the items taken from a variable length array
    so...
    ownsCar is represented by myObject.[N]
    ownsHouse is represented by myObject.[N+1]
    ownsBike is represented by myObject.[N+2]
    etc
    (sorry, this is so difficult to explain when I dont know what the answer is)

Maybe you are looking for