Hi Jimmy,

 

I wasn’t actually aware of the unregisterView method on the view helper! After adding this, the problem seems to be solved (cheers Steven).


From: Dimitrios Gianninas [mailto:[EMAIL PROTECTED]
Sent: 07 March 2005 13:55
To: [EMAIL PROTECTED]
Subject: RE: [flexcoders] Cairngorm view helpers and dynamic loading of content

 

Hi Michael,

 

I think the answer to your question is as simple as calling the unregisterView() method on the correct ViewHelper when you are destroying that view all together. Give that a try and let us know.

 

Jimmy Gianninas

Software Developer - Optimal Payments Inc.

 

 


From:Michael Herron [mailto:[EMAIL PROTECTED]
Sent: Monday, March 07, 20058:40 AM
To: [EMAIL PROTECTED]
Subject: [flexcoders] Cairngorm view helpers and dynamic loading of content

Hi all

 

Currently, I have a framework where separate “modules” are loaded in to a central panel using the createChild method. The reason for using this method as opposed to a view stack for example is the amount of these “modules” that I could potentially have is huge and it seems easier/cleaner to load the modules when required. And also, correct me if im wrong, but if a view stack was used, would each module notbe loaded upon first navigating to it and then be retained in memory?

 

When the user first selects a menu option and the required module is loaded, all works fine.  The user may then navigate to another module, whereupon the initial module is destroyed using the destroyAllChildren method and the new module loaded. The problem occurs if the user then triesto return to the original module. The module will attempt to register its view helper which will in turn cause the view locator to throw an error, as the view name has already been registered in the array of view helpers - even thoughthe view and view helper where destroyed when the new module was loaded. This is also problem for reusable components that are being made use of inside the modules.

 

To confirm that this was the problem, I commented out the view locators error checking and all worked fine. The way I see it, the only solutions are:

 

·         Use a view stack and switch the selectedIndex rather than using createChild/destroyChild – perhaps this should have been the correct design choice used in the first place? Using this method the components problem is also solved as the view can be registered through action script with the “view already exists” error being caught, and just reassigning the view attribute of the existing view helper to point to the existing instance of the component.

 

·         Add a forceRegister method to the view locator that will not performthe check for an existing view, write my own view helper class that will override the set name method and call this method. This method is obviously not ideal. Cairngorm is a solid framework and things like existing view helper checking exist for a reason.

 

Any thoughts/suggestions?

Cheers,

Mike Herron 

 



AVIS IMPORTANT

WARNING

Les informations contenues dans le present document et ses pieces jointes sont strictement confidentielles et reservees a l'usage de la (des) personne(s) a qui il est adresse. Si vous n'etes pas le destinataire, soyez avise que toute divulgation, distribution, copie, ou autre utilisation de ces informations est strictement prohibee. Si vous avez recu ce document par erreur, veuillez s'il vous plait communiquer immediatement avec l'expediteur et detruire ce document sans en faire de copie sous quelque forme.

The information contained in this document and attachments is confidential and intended only for the person(s) named above. If you are not the intended recipient you are hereby notified thatany disclosure, copying, distribution, or any other use of the information is strictly prohibited. If you have received this document by mistake, please notify the sender immediately and destroy this document and attachments without making any copy of any kind.




Reply via email to