Arrays within custom Classes - same array for different instances?

Hello all,
I have made a very simple custom class for keeping track of groups of offices for a company.  The class has a Number variable to tell it how many different offices there are, and an Array to store the individual offices by name.  It looks like this.
class officeCluster
    static var _className:String = "officeCluster";
    // variables
    var numOffices:Number;
    var locationArray:Array = new Array();
    // functions
    function officeCluster()
        trace("officeCluster constructor");
Very simple!
Now, it is my understand that when I create different instances of the class, they will each have their own version of "numOffices" and their own version of "locationArray".
When I run traces of "numOffices", this seems to be true.  For example,
trace(manufacturingOfficeCluster.numOffices);
trace(servicesOfficeCluster.numOffices);
yields
5
4
In the output panel, which is correct.  However, there is trouble with the locationArray.  It seems that as I assign different values to it, regardless of what instance I specify, there is only ONE array- NOT one for each instance.
In other words,
trace(manufacturingOfficeCluster.locationArray[1].theLocation);   // theLocation is a String.  The locationArray itself holds Objects.
trace(servicesOfficeCluster.locationArray[1].theLocation);
yields
New Haven, CT
New Haven, CT
even though I have defined elsewhere that they are different!
Is anyone aware of any issues partaining to using Arrays within Class instances?  Any help would be appreciated!
note:  I've been able to work around this by creating multiple arrays within the class and using a different one for each instance, but this seems very sloppy.

Unfortunately, the code segment you attached results in:
12
12
in the output panel.   So the problem must lie elsewhere!  Let me give some more detail...
There are several files involved. The "officeCluster" class file looks like this:
class officeCluster
     static var _className:String = "officeCluster";
     // variables
     var numOffices:Number;
     var locationArray:Array = new Array();
     // functions
     function officeCluster()
        trace("officeCluster constructor");
I have two actionscript files which contain object data for the individual offices.  They look like this...
var servicesOfficeCluster = new officeCluster();
servicesOfficeCluster.numOffices = 4;
var newHope:Object = new Object();
newHope.locationName = "New Hope Office";
newHope.theLocation = "New Hope, NJ";
//more data
servicesOfficeCluster.locationArray[0] = newHope; //array index is incremented with each entry
//more Objects...
and like this...
var manufacturingOfficeCluster = new officeCluster();
manufacturingOfficeCluster.numOffices = 5;
var hartford:Object = new Object();
hartford.locationName = "Hartford Office";
hartford.theLocation = "Hartford, CT";
//more data
manufacturingOfficeCluster.locationArray[0] = hartford; //array index is incremented with each entry
//more Objects...
As you can see, the only difference is the name of the officeCluster instance, and of course the Object data itself.  Finally, these are all used by the main file, which looks like this- I have commented out all the code except for our little test -
import officeCluster;
#include "manufacturingList.as"
#include "servicesList.as"
/*lots of commented code*/
manufacturingOfficeCluster.locationArray[1].theLocation = "l1";
servicesOfficeCluster.locationArray[1].theLocation = "l2";
trace(manufacturingOfficeCluster.locationArray[1].theLocation);
trace(servicesOfficeCluster.locationArray[1].theLocation);
Which, unfortunately, still yields
12
12
as output :\  Any ideas?  Is there something wrong with the way I have set up the class file?  Something wrong in the two AS files?  I'm really starting to bang my head against the wall with this one.
Thanks

Similar Messages

  • Can you run multiple APEX listeners for different instances on the same server

    Please confirm that we can run multiple APEX listeners for different instances on the same server?  Is it an xml setup configuration or do we need to do more??
    Thank You,
    Tony Miller
    SmartDog Services
    Austin, TX

    Yes.. Just exactly what I was looking for...
    Thanks Jari!!
    Thank You,
    Tony Miller
    SmartDog Services
    Austin, TX

  • SAP XI 3.0 Same source for different target in std Value mapping function

    Hi,
    We have replicated 4 value mapping entries from R3 to XI having the same Context , Agency , Schema and value for source, but each of the 4 values has the same Context and Agency but different Schema and Value respectively.
    To illusstate :
    Source                             |Target
    Context Agency Schema    Value -----Context Agency   Schema     Value
    CS1      AS1      SS1      1        CT1       AT1      ST1       A
    CS1      AS1      SS1      1        CT1       AT1      ST2       A
    CS1      AS1      SS1      1        CT1       AT1      ST3       B
    This value mapping is not working and we always get the source value as the result.
    We are wondering if the reason for this is that we use the same source for different targets. But we are not 100 % sure of it.
    When I read the documentation on Value mapping or when we use the value mapping standard function in graphical mapping, we pass the context , agency and schema of the source and target respectively and the source value to get the target value, and this combination is always unique in our case as seen in the above example.
    Has anyone faced this kind of an issue, if yes I would appreciate if anyone could help us resolve this problem.
    Thanks in advance.
    regards,
    Advait

    Hi Advait,
    From the below what I understand is that you are not able to do value mapping for the follwoing
    1     A
    2     A
    3     B
    As value mapping allow one to one mapping only. Please do it like as mentioned below
    1     1*A
    2     2*A
    3     3*B
    Then in the graphical mapping of Integration Repository do the mapping for the same as shown below
    source field > VALUEMAPPING> UDF--> TARGET Field
    In UDF suppress the value of  1* , 2* , 3* which can be done as follows
    create one UDF with one input field
    //write the code as below to suppress the field
    return input.substring(2);
    Here the davantage of using 1* , 2* , 3* etc is that you have the option to use value mapping for 100 values which I think is not normally the case for any Interface.
    If you have same source you can do the same thing for that.
    Hope this helps you to resolve your query.
    Thanks & Regards
    Prabhat

  • PPOME - Can't insert the SAME task for different organization unit

    Hi all,
    I have a doubt; in SAP 46C, it seems that is impossible to insert in PPOME, Detailed window, Tasks tab the same task for different organization unit. The only way to do this is in PP01 - General management, where you can explicitely create a [B-007] relations with the same "T" Object. Now, it is a little bit difficult for a user to switch from PPOME ad PP01 when defining new organizational structure.
    The question: is there any way to insert the <b>SAME</b> task directly in PPOME, overwriting the standard behaviour of the system that by default create a new task for each new insertion?
    Thanks all
    Paolo

    Hi Naveen
    thank you for your prompt reply.
    The issue that I want to solve is that some organization unit (not all) must be flagged for an external export to another system, depending on some characteristic of each org unit. I didn't find a similar attribute on standard field, so I thought to insert a common task to all the org units to export, so that this relation can serve as the missing attribute on org unit definition.
    PP01 let me insert a task (type T, and not TS) on an org unit directly, so I want to know if I'm going to break some standard behaviour of SAP if I insert a task on OU.
    Thank you
    Paolo

  • How can all of the same subscriber in different instance get the meesages?

    Hi
    I am using MDB to recieve messages from publisher, used for event and notification, I deploy same MDB into different instance, if there is a event, the publisher will publish a message, and all subscribers in different instance are supposed to get the message, but reffer to the message flow, only one of these MDB will recieve the messages.
    One solution is to have different clientID for these MDB in different instances. But unfortunately, the value for clientId should be constant expression.
    Here is my code, any suggestion?
    @MessageDriven(mappedName = "cluster_publisher_adm", activationConfig = {
         @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
         @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),
         @ActivationConfigProperty(propertyName = "clientId", propertyValue = "test"),
            @ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = "myTest"),
         @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic") })
    public class TopicListener implements MessageListener {
        public TopicListener() {
        }How can I have all the MDB in different instances to get the same messages?

    I presume you are using Glassfish and Glassfish Message Queue, and that your Glassfish instances are clustered. If so, then if an MDB (listening on a topic) is deployed into the cluster, each message will indeed be delivered to one MDB per cluster rather then to one MDB per instance. This is a feature known as "shared subscriptions".
    If you are using Glassfish 2.1.1 or 3 (but not earlier versions) you can disable this using an activation spec property. Take a look at the latest documentation at
    http://docs.sun.com/app/docs/doc/821-0027/aeooq?l=en&a=view&q=activationspec
    and scroll down to the new property "useSharedSubscriptionInClusteredContainer". You need to set this to false.
    Nigel

  • Urxvt - use different fonts for different instances of urxvt

    Hello. I use mcabber for IM which is a ncurses program. From what I understand, it is not possible to set font size for a ncurses program. Also urxvt uses .Xresources for configuration which sets the same font for every instance of urxvt.
    So I want to ask if it is possible to write a script to start urxvt with a different configuration file and then start mcabber in it.
    I understand that I can write a script to change font size in .Xresources and then use xrdb to merge the changes, but I do not understand how I can make that change local for only that instance of urxvt.
    Thanks

    Form man urxvt;
    -fn fontlist
    Select the fonts to be used. This is a comma separated list of font names that are checked in order when trying to find glyphs for characters. The first font defines the cell size for characters; other fonts might be smaller, but not (in general) larger. A (hopefully) reasonable default font list is always appended to it. See resource font for more details.
    In short, to specify an X11 core font, just specify its name or prefix it with "x:". To specify an XFT-font, you need to prefix it with "xft:", e.g.:
    urxvt -fn "xft:Bitstream Vera Sans Mono:pixelsize=15"
    urxvt -fn "9x15bold,xft:Bitstream Vera Sans Mono"
    I use it all the time.

  • Doing the same task for different data.. Do I need Queues? How to use them if yes?

    Hello all,
    I have created a VI which is getting data from some FTP server and then after comparing with the HDD specified folder copy the missing data from the FTP ... Description is also in the VI. There are few things I need to ask.
    1) The email sending VI gives error 1172..What could be the reason .. is it firewall.. or is there any mistake in the code?
    2) As you people are experts so I really like any suggestion to improve the VI..
    3) The most important .. Currently this VI can only perform the whole task for one FTP folder. Actually my task is I need to check for 4 different FTP folder on different servers..its not 4 different folder in one FTP .. its 4 different FTP.Now my question is how I can do this: First it compare and copy from FTP1.Then FTP2... and so on.. How can I change the data for the cluster for different FTPs? Do I need to use queues? If yes how because I don't have any experience with queues.
    I will really appreciate is someone can either provide me the relevant example or can give me some idea.
    The main VI is the 'TASK START'.VI please find the attached files.
    Thanks
    Regards,
    Naqqash
    Naqqash
    Attachments:
    Project.zip ‏151 KB

    Hi Peter,
    Thank you very much for your reply. I have understood your idea but there are few problems.
    Please see the attached "Final test.vi".. actually my top level vi should be like this.. due to this reason I need to develop the cluster like one with name "Settings" as shown in Enum FTP events.vi.. In this cluster all the data types are not constants (but can be set as constants)  and further all of them are not of same type so whenever I try to create as you created I have got error, wire broken..so what do you think i should do.. In this cluster there are different types of data .. string, path, numeric, array and a cluster with name file properties also... can't figure out what to do..I know things are little scattered and wiered but due to lack of experience, I guess, I am now a little bit confused for this matter. I
    hope guys here in the forum will help me as you guys always did.
    Naqqash
    Attachments:
    Final test.vi ‏11 KB
    Enum FTP Events.vi ‏14 KB

  • Same values for different address in BP

    Hi Guys,
    How to popup the standard (current) communication address details into new communication address details.
    Scenario:  The exited BP has one address and now he moved to another address, in that case we suppose to update or maintain his new address, am I right.
    When I click on u2018createu2019 for new address on address tab in BP, the screen should be popup with current address communication (Telephone number, mobile number, fax and email) details into new address communication fields.
    Ex : current address mobile number  9812345678, when you open new address.
    The new address screen mobile number field would be display with same number 9812345678. Without manually work.
    What is the solution for above business scenario in SAP 4.7
    Moderator message - Please do not offer points or rewards
    Cross post locked
    Thank you,
    Regards,
    Venkat.
    Edited by: Rob Burbank on Aug 5, 2010 10:30 AM

    Venkat
    You cannot make the present communication address for a customer to come into the address screen of the new customer you are creating.
    How does the system know that you are creating the master for the existing customer but with a new address!!!. It can be a new customer altogether.
    Another important thing is, In this scenario, you should not create a new BP master. Then the customer number will be different and all the old history of the customer will be useless for you for any analytical purposes.
    Just go to the customer master in change mode, and change the address. That should work well for ur need.

  • Same Contact for different customers

    I have same contacts (all details same) for different customer accounts (ex: Customer A, B, C etc). I have to duplicate contatcs in XD* or VAP* transactions.
    Is there a standard simple way to avaoid creating duplicate contact entries? Create contact (without attaching to customer) seperately and assign to different customers?
    Please help.

    Hi,
    If you want to assign as contact person sales employee responsible for contacts wit hthe customer, you shoudl rather use parther function PE and assign the employee number in the partner functions of the customer. Otherwise the requirement to assign the same contact person to several different customers is completely not clear for me (several companies rather do not employ the same people).
    Regards,
    Marcin

  • Listening to event within custom class

    I've created a custom class that posts to a web page to authorize a user. How can I listen for an event within the custom class?
    This is my code within my main class.
    var customClass:CustomClass = new CustomClass();
    var testingString = customClass.authorize("[email protected]", "password");
    the fuction "authorize" within the customClass looks like this:
    public function authorize(user:String, password:String):void
      jSession = new URLVariables();
                                  j_Loader = new URLLoader();
                                  jSession.j_username = user;
                                  jSession.j_password = password;
                                  jSend.method = URLRequestMethod.POST;
                                  jSend.data = jSession
                                  j_Loader.load(jSend)
    How can I fire an event within my main class once the j_Loader triggers Event.COMPLETE?

    You can fire an event using the dispatchEvent() function.
    In your main class you assign a listener for the event the CustomClass dispatches after it exists.

  • How to assign the same GTIN for different material?

    Hi,
    I've managed to install an internal number assignment for the GTIN / EAN in material master which works fine.
    Now we need to assign the same GTIN to different material numbers. 
    Since the defined number range is marked as internal I cannot use this number range as the external number range in spro -> Define Attributes of EANs/UPCs (number categories/EAN categories):
    I cannot make an external number range with the same data as the internal one, since number ranges must not overlap.
    So, here is the question again:
    How can I achieve that 1. the GTIN is generated and 2. a GTIN, which is already assigned to another material, can be entered manually in the GTIN field?
    Any advice is appreciated,
    thanks,
    Marco.

    1. the GTIN is generated
    This should be "external" number range only.
    2. a GTIN, which is already assigned to another material, can be entered manually in the GTIN field?
    We can enter manually or thru' upload during master data creation provided number range is "external"(refer point no.1 above)
    Unable to understand that why you need same GTIN in two different articles?
    Request to understand the business process once again as this leads to confusion reg. inventory, PDC and PoS dumping.

  • Can you change rollover text in the same slice for different triggers?

    Hi, I haven't used Fireworks since version 3, which was about 6 years ago, when I dabbled in web development.  My past has come back to haunt me, and I need to make a fairly simple website pretty quickly for my boss.  I've got myself CS4, and now that I've figured out that you can't use buttons for disjoint rollovers, I'm starting to make progress...
    What I want to achieve, is that there are 6 'buttons' on my page, which when you rollover them will display text in a box to the side.  I would use separate boxes for each button, but there isn't enough space on the page, as there is quite a lot of text, so I would like to use a box in the same place to display any of the 6 texts, depending on which button is rolled over.  Can this be done?
    I probably haven't quite got my head round layers, and this may be very simple, but could someone please point me in the right direction, even if it is a link to the right bit on product help?
    Because the button disjoint rollover doesn't work, I have created 6 slices for the triggers.  I tried hotspots first, but couldn't use them as I also want a rollover live filter effect on the trigger.

    Yes, you can trigger different slice contents on rollover from multiple other slices.
    It's easier to show than describe, so here is a sample file that does what I think you're looking for:
    (1) six buttons
    (2) each button has unique text
    (3) each button has a rollover state
    (4) unique text is displayed in the same place for each button on rollover
    Hope this helps!
    Dave
    Right-click and save the image below - it's a Fireworks source file:

  • Same variant for different value in enumerations

    Hello.
    Is it a bug?
    I have this type in my schema:
    <xs:simpleType name="VolumeUnit">
    <xs:restriction base="xs:string">
    <xs:enumeration value="ml"></xs:enumeration>
    <xs:enumeration value="µl"></xs:enumeration>
    </xs:restriction>
    </xs:simpleType>
    In the generated class I got:
    static final Enum ML = Enum.forString("ml");
    static final Enum ΜL = Enum.forString("µl");
    static final int INT_ML = Enum.INT_ML;
    static final int INT_ÎœL = Enum.INT_ÎœL;
    What do you think about that?
    How could we manage the generated code

    Hi Advait,
    From the below what I understand is that you are not able to do value mapping for the follwoing
    1     A
    2     A
    3     B
    As value mapping allow one to one mapping only. Please do it like as mentioned below
    1     1*A
    2     2*A
    3     3*B
    Then in the graphical mapping of Integration Repository do the mapping for the same as shown below
    source field > VALUEMAPPING> UDF--> TARGET Field
    In UDF suppress the value of  1* , 2* , 3* which can be done as follows
    create one UDF with one input field
    //write the code as below to suppress the field
    return input.substring(2);
    Here the davantage of using 1* , 2* , 3* etc is that you have the option to use value mapping for 100 values which I think is not normally the case for any Interface.
    If you have same source you can do the same thing for that.
    Hope this helps you to resolve your query.
    Thanks & Regards
    Prabhat

  • Same BI for different dev envir

    Dear All,
    We have two development environment groups in our organization, both needs to be worked independently in our implementation work for ECC industrial modules.
    we are planning to implement the netweaver systems such as BI, EP for both development systems.
    Question here is, can we use same BI system for different ECC development environments?
    or do we need to separately create two BI systems and integrate with respective ECC 6.0 modules.
    Thanks and Regardsa

    Hi,
    Yes, you can connect 2 different development systems from same BI system. You need to create 2 different source systems in RSA1 in BI.
    Thanks
    Sunny

  • Using same Context for different phy. environments

    Hi,
    i have a small question regarding contexts in ODI. Hope someone can help me.
    Following situation:
    We have 3 databases with same db object structure on three different servers and want to integrate them into one target structure.
    Step1: Initialize target structure (truncate table etc.)
    Step2: Load data from first Database
    Step3: Load data from second Database
    Step4: Load data from third Database
    We want to use the same interface for all of them in order to keep it simple and avoiding duplicate interfaces. So i think we need something like a context/server change during execution. Is this possible to use the same interface for serveral environments and how?
    thx, for your help
    best regards,
    Kai

    Hi Kai,
    Please, take a look into the post http://odiexperts.com/?p=652 maybe it can help you a little....
    And the answer to you questio is YES. That is one of the context functions.
    Just create one context to each database and execute the same interface, but at each context...
    Does it help you?
    Cezar Santos
    http://odiexperts.com

Maybe you are looking for

  • Fiscal period issue in query?/

    Hi all, 1) I <b>need to have a variable-fiscal year/period (mandatory/single entry)</b> in my query. but I have a problem to create one because <b>my fiscal variant (for fiscal year/period) is filled by 'March'</b> and in the '<b>filter</b>' section.

  • Frmall.jar source code

    Hi, Does anyone know how to get the source code of frmall.jar, not the class files. Thanks.

  • Why are my download instructions in Arabic?!

    Why are my download instructions in Arabic?! I purchased and downloaded directly from the Abode website.

  • Need help translating crash report

    Hi. I wonder if someone can help me translate this crash report. It occurs when using Adobe Illustrator on a MacPro (10.6.8) with 9GB RAM. Many thanks. Process:         Adobe Illustrator [597] Path:            /Applications/Adobe Illustrator CS5/Adob

  • HT1600 how long does the apple tv update take

    How long does it take to download the update for Apple tv?  It has already been 2 hours and it has not moved.