How access an item by using its name or id if this isn't a class variable?

I'm recovering the item that I added to my user interface in a different function. I use actionscript 3. I know that I can put the variable in a class variable, so it can be access anywhere in the class, but I have too many items. Is there anyway that I could access it without putting them in the class variable?

Thank you.

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 */
}

Of course, because you don't want to create in the first place of the variables

But you could add one to a dictionary of class and get your references from there.

Something like this:

private var objArray:Dictionary = new Dictionary();
private function init (): void
{
var image: Image = new Image();
ObjArr ['image'] = addElement (image);
trace (gridArray ['image']);
}

Tags: Flex

Similar Questions

  • We can access the session scope variable just by using its name

    Java EE 6 tutorial contains a "Case Study of the Duke's Bookstore example". I did not understand after statements of this case study:

    * bookdetails. XHTML *.

    {code}
    < h:outputText value = "#{selected.title}" / >
    {code}

    * BookstoreBean.Java*

    {code}
    public String details() {}
    Context()
    . getExternalContext()
    . getSessionMap()
    .put)
    "selected."
    getFeatured());

    return ('bookdetails");
    }
    {code}

    I want to know we can access the defined in bookdetails.xhtml session variable by simply using his name as done previously?

    This is a feature of basic Expression Language (EL), it is not specific to JSF. And it is not specific to the scope of the session, or you can put the beans in any area (page, request, session, application, flash, conversation, regardless of how extensive custom that you create) and reference it using EL only his name. The thing you need to take care of, is that the bean lives in a scope, which can be done using JSF specific or files of configuration, through CDI, annotations or by manually setting the bean in a specific through Java code scope. It is flexible, that is the nature of the Java platform.

  • How to get the static attribute by using its name as a string

    I have an app with about 100 boxes of single drop-down list (this is a requirement of the Government, I'm not that bad a designer) and I would like to define the choices in a single file separated like this:

    package components {}

    Import mx.collections.ArrayCollection;

    public class {choice}

    [Bindable] public static var A0310A: collection ArrayCollection = new ArrayCollection ([] collection
    {value: '01', label: 'Admission'},
    {value: "02", label: "Quarterly"},
    .. .snip...
    ([{value: "99", label: "NOT the OBRA required"}]) ;

    public static void getChoices(name:String):ArrayCollection {}
    var temp: ArrayCollection = collection?
    Return temp;
    }

    }//----------------end of class--------------------------------
    }//======================== end of package==============================

    I want to use it like this

    < my: ComboBox id = "mdscombo" tag = "A0310A" / >

    Where the definition of my: ComboBox includes the code like this

    var zz:ArrayCollection = Choices.getChoices (name);

    but I can not find any function that will allow me to do.  I don't want really clutter up the code by creating a name-> object mapping table.

    I had also considered using the XML data type, but I have the same question, unless I had all the choices under a single root (possible), but this could be a nightmare when debugging in typo XML file.

    Any suggestions?

    To answer your question, you can access static variables with a chain in this way:

    Choice ["A0310A"]

    However, you probably want to re-evaluate your design because this isn't a very desirable approach.

  • How to find a table, using the name of the column in the database schema

    Dear all,

    Please help me on

    using the name of the column, how to find a table name in the database schema.

    Thanks in advance

    Hello

    You can query the data dictionary views all_tab_columns and user_tab_columns.
    For example, to find the tables in the scott schema have called deptno columns:

    SELECT  table_name
    FROM    all_tab_columns
    WHERE   owner           = 'SCOTT'
    AND     column_name     = 'DEPTNO';
    

    Remember that anything inside quotes is case-sensitive.

    The all_tab_columns view has one row for each column in each table (or view) that you have the privileges to use.
    The user_tab_columns view is a subset of all_tab_columns, containing only your own tables (and views).

  • How is group a cluster by its name?

    I created a group of 2 calculated values (x = r * cos (angle) and y = r * sin (angle) where are and angle are given by sensors (the angle is converted to radians).)  The documentation says "right click on the cluster and enter the names (presumably, x and y in my example.).  I followed the instructions, but no window open to allow me to provide the names.  What I am doing wrong?

    Hello jpnoon,

    I'm not familiar with the documentation that you reference, but the next tutorial does a good job of table describing and cluster basics.

    Tutorial: Arrays and Clusters

    Best regards

  • help Windows cannot access the specified device, path or file. You can not have the appropriate permissions to access the item.

    I downloaded a game and I'm going to open and it says Windows cannot access the specified device, path or file. You can not have the appropriate permissions to access the item.

    The thing is I had this game on this laptop before and worked fine.

    But every time that there is a update for the game, you have to uninstall it and then reinstall it.

    When I reinstalled it.

    I now get Windows cannot access the specified device, path or file. You can not have the appropriate permissions to access the item.

    It's windows 8, I am using.

    What is the problem?

    Hello

    Thanks for the reply.

    You can try to temporarily disable the antivirus program and check the results. It can also occur if you have not enough permission to run the file.

    Caution:

    Antivirus software can help protect your computer against viruses and other security threats. In most cases, you should not disable your antivirus software. If you need to disable temporarily to install other software, you must reactivate as soon as you are finished. If you are connected to the Internet or a network, while your antivirus software is disabled, your computer is vulnerable to attacks.

     

    Response with status.

  • Cannot access through its name WD my cloud

    Hi, I am using OSX Seira. I try to connect to my WD my cloud device by using the name of the device via its app, but can not access. But when I use the IP address of my cloud, I can access it easily. It is also perfectly show in Finder.

    Can someone guide me why can not use it by name?

    Ignore it. When I rebooted the WD my cloud device. It works fine now. Don't know why this has happened.

  • How can I get Mozilla to use the name of the page for the name of the real instead of the URL bookmark when I bookmark a page

    I just noticed that (in comparison to Internet Explorer): in IE, when you preferred a Web page, it uses the actual name of the Web page (for example, for this page, it would be "Ask a Question Firefox Help" as the name of the bookmark), but in Mozilla, it uses the URL as the name of the bookmark. I was wondering if it was possible to change my Mozilla settings so that it uses the name of the Web page as the bookmark name instead of the URL? I hope that everyone understands what I am getting? If anyone can help me, I would really appreciate it. Thank you.

    Firefox uses the tag title for the name of the newly saved bookmark.

    When I bookmark on this forum page I get this for the 'name' of the bookmark.

    How can I get Mozilla to use the name of the page for the name of the real instead of the URL bookmark when I bookmark a page | Firefox Support Forum | Firefox help

  • How safe is using secret ios app from appstore to store important documents? Can the creater of ios app app have access to my stuff using their secret app? Thank you

    How safe is using secret ios app from appstore to store important documents? Can the creater of ios app app have access to my stuff using their secret app? Thank you

    Of "secret iOS app" are what kind you referring? You will need to provide more information for someone to respond to you.

  • Use: How to read a single line of names of channel or units?

    Most of the examples of programming to use use channel names in separate lines, as in the following example:

    Channel
    Name: time
    Type: time

    Channel
    Name: XShift
    Type: R64

    Channel
    Name: YShift
    Type: R64

    Most of my data sets have channel names and / or units in one line separated by tabs as

    "Dehnung" "Standardkraft" "Sensor" "Zyklusnummer" "PWM".

    « mm » "N" "V" « » « % »

    Is there a more effective way to add channels appointed and equipped with units along these lines to bike through some index variable? Like my channel number, etc. naming vary frequently, I would be looking for a more flexible solution, avoiding fixed table or names hardcoded sizes.

    I guess

    aMyChannelNames = split (File.GetNextStringValue (eString), vbTab)

    aMyChannelUnits = split (File.GetNextStringValue (eString), vbTab)

    for i = 0 to UBound (aMyChannelNames)

    Adjust the strings = Block.Channels.Add (aMyChannelNames (i), eString)

    Channel.Porperties ("Unit") = aMyChannelUnits (i)

    next

    could do the job - but it's the most effective way?

    Thank you for helping.

    Michael

    Hello Michael,

    I don't see the real problem.

    You read the header and split it into an array. This is information you have how many channels. Table size ubound depends on the line you have red and is not fix. Everything should be good now.

    You read the information and would divide the tables. Then, you use a loop to generate channels and set the properties. I don't think that there is a better way to do it.

    Kind regards

    Philipp K.

    AE | OR Germany

  • Can access the shared folder by using the name of the server, but is unable to use the intellectual property

    Hi, I need help with a very strange problem.

    I have a Server 2003 domain controller to PC and all the domain user can access any shared folder of the server using IP address or FULL domain name.

    So I joined a R2 of 2012 new server to the domain as a workstation normal and not as a new domain on the network controller, and the problem is that one cannot access a shared folder on the new server by using the IP, but can be accessed using the name of the computer.

    My Admin user can access the folder using the IP address or the name comp. on any work, but the user of my AD position may not use intellectual property.

    I can using Ping IP or name of the computer for every user of AD.

    Please check the attached images.

    When I try to access it using IP, it gives me the following error:

    \\192.168.0.2 is not accessible. You might not have permission to use this network resourse. Contact the administrator of this server to fing out if you have access permissions.

    Currently, there are no available connection server to process the logon request.

    Hello

    You may need to ask the question on the TechNet Forums:

    https://social.technet.Microsoft.com/forums/WindowsServer/en-us/home

    Kind regards

  • I want to know how to restore the computer to its factory settings, when I bought from a private party and have an administrators access code

    I want to know how to restore the computer to its factory settings, when I bought from a private party and have an administrators access code

    Hello

    What is the brand and model of the computer?

    The best method is to contact the computer manufacturer for help on how to set the computer to its factory settings.

    Hope this information helps.

  • When I try to access 'My images' closed Windows program using its Data Execution Prevention

    Original title: when I try to access the closed Windows "My pictures" the program using it is Data Execution Prevention - how can I stop this?

    See above

    Hi PeterMcRitchie,

    ·         Did you do changes on the computer before the show?

    ·         You get the error message?

    Follow these steps:

    Step 1: Start the computer in safe mode and check if the problem persists.

    A description of the options to start in Windows XP Mode

    http://support.Microsoft.com/kb/315222

    Step 2: If the problem does not still in safe mode, perform a clean boot to see if there is no conflict of software like clean boot helps you eliminate software conflicts.

    How to configure Windows XP to start in a "clean boot" State

    http://support.Microsoft.com/kb/310353

    Note: After completing the steps in the clean boot troubleshooting, follow the section How to configure Windows to use a Normal startup state of the link to return the computer to a Normal startupmode.

    After the clean boot used to resolve the problem, you can follow these steps to configure Windows XP to start normally.

    (a) click Start, run.

    (b) type msconfigand click OK.

    (c) the System Configuration Utility dialog box appears.

    (d) click the general tab, click Normal startup - load all services and device drivers and then click OK.

    (e) when you are prompted, click on restart to restart the computer.

  • How to create a list of button by using the names of a table

    Hi, I want to create an application that displays detailed information about something. for example, as the profile of the users. my application will read an xml response from the server that contains the list of the names of the users. How to create a list of buttons using the names and then each button that displays the name that can be pressed and displays detailed information about the name? I think that it is similar to the BBM app that displays a contact list of the user. Thank you very much

    Create a ButtonField as:

    ButtonField [] users_buttons = new ButtonField [number of users];

    Initialize the uasing dem:

    for (int i = 0; i)<>

    users_buttons [i] = new ButtonField ("user", Field.FIELD_HCENTER |) ButtonField.CONSUME_CLICK);

    Make dem clickable setchangeListener method of buttonField and Ooveride Navigation click to make a few operatoin by clicking on the specific button!

  • Download "Do not have permission to access the item" when you use software.

    Original title: authorization

    I use a software to capture analog video tapes from my VCR... It works fine on my PC (Windows 7), but there is a problem with my laptop (Windows 7).  When I click the icon of the software on the desktop, I agree "' > you may not have appropriate permission to access the item '." I've uninstalled and reinstalled the software 4 times. I went into properties and different answers enter the security forms (they are very confused by the way), nothing works. It's very frustrating. I'll be grateful for any help I can get. I have

    Hello

    What happens if you right click on the Desktop icon > then select run as administrator?

    See you soon.

Maybe you are looking for