[flexcoders] Re: Use of viewLocator and viewHelper

2006-08-31 Thread mamatha_tn
Thanks for the example.But I still have some questions.
1)Is viewHelper used to segregate as code from mxml?
2)Its not used in any of examples provided for Cairngorm 2 nor is it 
part of any discussion about cairngorm 2 architecture.Is it an 
optional feature retained from cairngorm 0.99?
3)If I dont have any need to manipulate the mxml file from other 
files(which you have mentioned below), should I still go ahead and 
create a viewHelper for each view? 

--- In flexcoders@yahoogroups.com, e baggg [EMAIL PROTECTED] wrote:

 //mainScreen.mxml
 ?xml version=1.0 encoding=utf-8?
 mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml; width=100% 
height=100% 
 xmlns:viewHelper=com.myapp.view.* verticalGap=0 
 viewHelper:MainScreenViewHelper id=mainScreenViewHelper /
   mx:Label id=mylabel text=Hello World/
 /mx:VBox
 
 //MainScreenViewHelper
 package com.myapp.view
 {
 import org.nevis.cairngorm.view.ViewHelper;
 import com.communify.model.ModelLocator;
 
 /**
  * Gives a handle to main.mxml and its subcomponents
  */ 
 public class MainScreenViewHelper extends ViewHelper{
 private var model:ModelLocator = ModelLocator.getInstance
();
 public function MainScreenViewHelper(){
 super();
 }

 public function updateLabel(updatedString : String):void{
 Label(view.mylabel).text = updatedString;
 }
 
 }
 }
 
 So, the line of code viewHelper:MainScreenViewHelper 
id=mainScreenViewHelper / instantiates the ViewHelper class and 
registers it with the singleton class ViewLocator. This means that 
any class or mxml file can access the components of the 
MainScreen.mxml by calling:
 
 var viewHelper : MainScreenViewHelper = MainScreenViewHelper
(ViewLocator.getInstance().getViewHelper(mainScreenViewHelper));
 viewHelper.updateLabel(otherTextField.text);
   
 -
 Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  
Great rates starting at 1ยข/min.








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
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]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




Re: [flexcoders] Re: Use of viewLocator and viewHelper

2006-08-31 Thread Tom Chiverton
On Thursday 31 August 2006 05:38, mamatha_tn wrote:
 1)Is viewHelper used to segregate as code from mxml?

Sort of, or interactions with the model (as) from the view (mxml).

 3)If I dont have any need to manipulate the mxml file from other
 files(which you have mentioned below), should I still go ahead and
 create a viewHelper for each view?

I can't see the point for trival views.

-- 
Tom Chiverton
Helping to interactively aggregate value-added action-items



This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at St 
James's Court Brown Street Manchester M2 2JF.  A list of members is available 
for inspection at the registered office. Any reference to a partner in relation 
to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law 
Society.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents.  If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 8008.

For more information about Halliwells LLP visit www.halliwells.com.



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
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]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/