Sorry, I’m really busy right now and I’ve spent way too much time on this one already. I cannot post you the code that had this problem, since you cannot run it anyway without the backend. But I’ll try to write a piece of code to demonstrate the problem later after I get through this busy schedule I have right now. (And of course then I cannot reproduce it… J )

 

But I had this problem earlier also… (see below) ..

 

----

 

 

Object deletion is just like in Java, we garbage collect once there are no more references to the object.  So if the popup window has a reference to another model, deleting the popup window does not delete the model, it only deletes the reference.  Now if the source object has also removed its reference, then you've now gotten rid of both references and the object is gone.

 

I'd need to see more of an example to give you a better sense of where things might be going wrong.  From your other posts it looks like you've gone down the route of creating copies which may be fine but also may be masking your problem.

 

Matt

 

-----Original Message-----
From: Mika Kiljunen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 08, 2004 8:49 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Objects disappear

 

Hi again J

 

I noticed some weird behaviour with flex yesterday. Let's say I have a Model named myModel. myModel contains 'strings', but is an object array (created from xml). Next I have a popup window that has a model popModel. On creation popModel = myModel. Popup window binds strings from popModel to fields and labels etc. Popup window has 2 buttons, one to Cancel and one to DoOperation. If Cancel is pressed, popup window dies and gets popped up again. Everything works nicely. If DoOperation is pressed, popup window dies and operation is called (remote_object). Everything works nicely.

 

Now: If I press first Cancel and then DoOperation AND DoOperation fails and popupwindow is displayed again ALL the text on the labels are gone. Closer look with the debugger shows that also the objects in the popModel that are binded on the popupwindow are gone (=undefined). Even further, all the objects (strings) on myModel object that are used with popupwindow are gone (all the other ones are there). Now this is weird. I believe that this is caused by the fact that object arrays are passed as a reference and popup window seems to destroy all the references in it when it dies and so it destroys the original objects used by it on the original object array (model). Is this correct and what would be a proper way to deal with this kind of behaviour with the popup windows?

 

-Mika

 

 

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Matt Chotin
Sent: 13. toukokuuta 2005 7:27
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] applications that forget variables

 

Can I see code that demonstrates this problem?

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Mika Kiljunen
Sent: Thursday, May 12, 2005 6:50 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] applications that forget variables

 

Hi, you seem to be having the same problem that I had earlier (on popup and binding ) and I faced it again yesterday. I have an array on my main as file that contains Value objects.

I launch a popup window and the popup window sets it’s internal variable like this iMyArray = mx.core.Application.application.getArray();

Now this is used in a popup as a dataprovider for a combobox. Also the popup has a binding on the combobox like <somevalue>{myCombo.selectedItem.aValueField}</somevalue>.

These work nicely until I choose a value, close the popup and relaunch the popup to edit some data that was setup earlier. Now the aValueField in the ValueObject that is contained in the array is undefined (destroyed by flex). ValueObject is otherwise ok, only the field that was binded on the popup is undefined.

 

I solved this by creating a copy of the array in the popup and using that (so that it does not reference the array on the main app -> hence the original array will stay untouched). This way all works fine, but it’s a real bummer that I have to make a copy of the array (that is readonly!) so that flex won’t destroy the original array’s object’s field.

 

I suspect, that the binding & a popup seems to behave somewhat weird, because it really should not destroy the field on the object of an array that is defined on the main app when the popup/binding is destroyed.

 

-Mika

 

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of [EMAIL PROTECTED]
Sent: 12. toukokuuta 2005 16:21
To: flexcoders@yahoogroups.com
Subject: [flexcoders] applications that forget variables

 

Is there a limit to a scope of a variable if I store it in an array because I have done so in the past declared it public at the top of the mxml file yet at times it seems the computer forgets the value by the time it goes through like ten functions. Is this unusual and if so is there a way to prevent this from happening?

 

 

 



Yahoo! Groups Links

Reply via email to