Let's start with dont use ViewHelpers :)
 
Create your component, give it properties that will allow the app to change its 
behavior and then allow the component to broadcast events to tell the app that 
something happened to it. Thats all you need. So your componet can either be an 
AS class or an MXML file with some AS mixed-in (dont' externalize the AS code 
cause it will just be confusing to manage).
 
Dimitrios Gianninas
Developer
Optimal Payments Inc.
 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
fuad_kamal
Sent: Sunday, April 08, 2007 8:21 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] seeking half-way point between view helper (Cairngorm) 
and re-usable components



Cairngorm viewhelpers are a great way to keep you mxml components neat
and clean by keeping most of the AS code out of them, they give a
meaningul and easy to follow way to refer to a component from anywhere
in the application, rather than crazy references like
parent.parent.parent.etc... or
Application.application.blahblah...which also break as soon as you
move your component around.

Each viewhelper must be registered by the mxml component to which it
is a reference to using a unique id. This has its reasons and its
strengths.

The problem occurs, though, when you want to create a self-contained
component that can be used repeatedly throughout the application. If
this component uses a viewhelper rather than keeping all its AS code
internal to itself, as soon as two instances of it appear within your
application you get an error because you're actually trying to
register two view helpers with the same name.

I realize that the ViewHelpers aren't really meant to be used simply
for convenience, they are used to give that unique handle to a command
class, but still, the convenience part is really nice.

I suppose you could still keep most of your AS code external to the
mxml by just using an include to an AS file, but you still lose the
benefit of the easy references.

Has anyone thought about this much? Is there a simple solution to this?



 

-- 
WARNING
-------
This electronic message and its attachments may contain confidential, 
proprietary or legally privileged information, which is solely for the use of 
the intended recipient.  No privilege or other rights are waived by any 
unintended transmission or unauthorized retransmission of this message.  If you 
are not the intended recipient of this message, or if you have received it in 
error, you should immediately stop reading this message and delete it and all 
attachments from your system.  The reading, distribution, copying or other use 
of this message or its attachments by unintended recipients is unauthorized and 
may be unlawful.  If you have received this e-mail in error, please notify the 
sender.

AVIS IMPORTANT
--------------
Ce message électronique et ses pièces jointes peuvent contenir des 
renseignements confidentiels, exclusifs ou légalement privilégiés destinés au 
seul usage du destinataire visé.  L'expéditeur original ne renonce à aucun 
privilège ou à aucun autre droit si le présent message a été transmis 
involontairement ou s'il est retransmis sans son autorisation.  Si vous n'êtes 
pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, 
veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses 
pièces jointes, de votre système.  La lecture, la distribution, la copie ou 
tout autre usage du présent message ou de ses pièces jointes par des personnes 
autres que le destinataire visé ne sont pas autorisés et pourraient être 
illégaux.  Si vous avez reçu ce courrier électronique par erreur, veuillez en 
aviser l'expéditeur.

Reply via email to