Lucas, remember variables are references to objects; A = B doesn't mean "Put in A the same data that is in B", it means "Make A reference the same object that is currently referenced by B".
I.e.: var a : Number = 1; var b : Number = 5; /* a + 3 returns 4 b + 9 returns 14 a + b returns 6; */ //Now make a reference the same object as b (in this case, make a no longer reference 1, but 5) a = b /* a + 3 returns 8 b + 9 returns 14 a + b returns 10; */ The same goes to any variable, not only the ones referencing basic types. Please reffer to the other email you sent, I wrote a much more clearer example there. Good luck! On 4/30/07, Lucas Pereira <[EMAIL PROTECTED]> wrote:
HI all. maybe my question fits here. here it goes. I have an object A of some king and object b of same kind as A.. if I make B.someproperty = A.someproperty and then make changes to be property in B, such has, B.someproperty = "something", why do the someproperty in A also changes? Any way to get around this? a common case is, if I have Object A of array collection with 1000 objects inside, and i want to create a Object B of array collection, and want B to have all the 1000 values that A has i will do B = A, instead of running the A array and push each value into B. The problem is same as above, if then i push another value on B (A.length would be 1001) the same value will be pushed to A array (A.length = 1001)!! Is this normal? Or is there a way in flex to say that i Want B to have same content as A, but then change B without affecting A? Thanks Lucas --- In [email protected] <flexcoders%40yahoogroups.com>, "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > On your second question, regarding refreshing the screen, the ideal > solution is to use data binding. If your screen elements are bound to > some dataProvider, and that dataProvider changes, the screen elements > will automatically refresh, no programattic work is necessary. > > > > In your tab example, you should only need to "refresh" the data if it > changes, and binding will handle that for you. > > > > Do you need to explicitly refresh your data model every time the user > navigates between tabs? Do that on a navigation event, and your bound > field/elements will update automatically > > > > Tracy > > > > ________________________________ > > From: dmitriy_orlovskiy [mailto:[EMAIL PROTECTED] > Sent: Monday, July 26, 2004 10:37 PM > To: [email protected] <flexcoders%40yahoogroups.com> > Subject: [flexcoders] Re: global variable vs passing parameters to the > cus tom components > > > > Thank you very much for the response. > Does it mean that vars need to be defined in the script file that > has reference to the Application tag? > Is parentApplication property is the same as accessing data this way: > mx.core.Application.application.userObject.userId or is it different? > > What is the good practice for refreshing data on the screen? > creationComplete event for the container fires only once. Which > event in the container to use to referesh data from the database, > every time component becomes active? > Let's say there are multile tabs. Every time when tab is selected, > refresh data is needed. How to do that inside of the component > without using tab change event and broadcast it to the component > somehow? How to do that? > > Thank you > > --- In [email protected] <flexcoders%40yahoogroups.com>, Gordon Smith <[EMAIL PROTECTED]> wrote: > > The use of _global in Flex applications is generally discouraged. > Instead > > you could store your user information in vars of the Application > object and > > use the parentApplication property to access them from multiple > custom > > components. > > > > If the information needs to be accessed by many custom components, > this is > > probably preferable to storing it redundantly in each component. > > > > Another common pattern is to separate data from UI by having a > singleton > > DataModel class for storing data. > > > > - Gordon > > > > > > -----Original Message----- > > From: dmitriy_orlovskiy [mailto:[EMAIL PROTECTED] > > Sent: Monday, July 26, 2004 3:04 PM > > To: [email protected] <flexcoders%40yahoogroups.com> > > Subject: [flexcoders] global variable vs passing parameters to the > custom > > components > > > > > > Hello, > > Are there any advantages/disadvantages to use _global variables in > > flex? > > What is the difference between storing user information (that > needs > > to be retrieved only once) in _global variable vs to pass user > > information to the custom component as a custom property (with use > of > > the set methods and assigning it to local variable that will be > > stored inside of the component). > > What would be prefered method in that case? > > > > Thank you > > > > > > > > > > > > Yahoo! Groups Links > > > > > > Yahoo! Groups Sponsor > > ADVERTISEMENT > click here > <http://us.ard.yahoo.com/SIG=129ntq3f3/M=295196.4901138.6071305.3001176/ > D=groups/S=1705007207:HM/EXP=1090982198/A=2128215/R=0/SIG=10se96mf6/*htt > p:/companion.yahoo.com> > > > <http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=group > s/S=:HM/A=2128215/rand=684700556> > > > > ________________________________ > > Yahoo! Groups Links > > * To visit your group on the web, go to: > http://groups.yahoo.com/group/flexcoders/ > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED]<flexcoders-unsubscribe%40yahoogroups.com> > <mailto:[EMAIL PROTECTED]<flexcoders-unsubscribe%40yahoogroups.com>?subject=Unsubscribe> > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of > Service <http://docs.yahoo.com/info/terms/> . >
-- No puedo con todo...

