RE: [flexcoders] How to set EventListeners to undrawn components on a ViewStack?

2006-08-21 Thread Gordon Smith












If you feel that it is important to
separate MXML and ActionScript, I suggesting writing MXML event attributes like
this



 mx:Button id=okButton
label=OK click=okButton_click(event)/



and then implementing okButton_click() in
a separate .AS file that you bring in using



 mx:Script source=MyApp.script.as/



That way, the MXML doesn't really do
anything; it just makes sure that the appropriate AS event handler gets set up.



I can also think of two other ways to
solve your problem, but I don't recommend either one.



You could set
creationPolicy=all on the ViewStack. But this will defeat the
purpose of MXML's deferred instantiation feature, which is to
minimize startup time by not creating visual components (such as the children
of the 2nd pane of an ViewStack) until they need to be displayed.



You could also override childrenCreated()
in each ViewStack pane and, after calling childrenCreated(), use
addEventListener() to attach your event handlers to that pane's children.



- Gordon











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Sascha Balkau
Sent: Friday, August 18, 2006 6:28
PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] How to
set EventListeners to undrawn components on a ViewStack?













Thanks Gordon! Sometimes I dont see the
easiest solution by myself! However Im trying to keep MXML code and
functionality code separate so Im wondering if there is another workaround
for this? Though I can live with your suggestion in this situation.



Sascha

















From: [EMAIL PROTECTED]ups.com
[mailto:[EMAIL PROTECTED]ups.com]
On Behalf Of Gordon Smith
Sent: Saturday, 19. August, 2006
08:39
To: [EMAIL PROTECTED]ups.com
Subject: RE: [flexcoders] How to
set EventListeners to undrawn components on a ViewStack?





Why call addEventListener() yourself? If you simply put an
mouseDown or whatever event atttribute on your content item in MXML, it should
work fine; addEventListener() will get called for you when the content
item gets created.



- Gordon











From: [EMAIL PROTECTED]ups.com
[mailto:[EMAIL PROTECTED]ups.com]
On Behalf Of Sascha Balkau
Sent: Friday, August 18, 2006 5:28
AM
To: [EMAIL PROTECTED]ups.com
Subject: [flexcoders] How to set
EventListeners to undrawn components on a ViewStack?











Hi list,

I'm using a LinkBar with a ViewStack and on any of the ViwStack contents I
have a button that needs to get a MouseEvent listener.

When I start the app, I get an exception : Cannot access a property or
method of a null object reference. Because all the buttons on the
VieStacks
that have not yet been drawn are not defined for the AddEventListener.

Is there an easy workaround for this situation?

Thanks,
Sascha





___ 














__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___






[flexcoders] How to set EventListeners to undrawn components on a ViewStack?

2006-08-18 Thread Sascha Balkau
Hi list,

I'm using a LinkBar with a ViewStack and on any of the ViwStack contents I
have a button that needs to get a MouseEvent listener.

When I start the app, I get an exception : Cannot access a property or
method of a null object reference. Because all the buttons on the VieStacks
that have not yet been drawn are not defined for the AddEventListener.

Is there an easy workaround for this situation?

Thanks,
Sascha




--
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] How to set EventListeners to undrawn components on a ViewStack?

2006-08-18 Thread Gordon Smith












Why call addEventListener() yourself? If
you simply put an mouseDown or whatever event atttribute on your content item
in MXML, it should work fine; addEventListener() will get called for you when
the content item gets created.



- Gordon











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Sascha Balkau
Sent: Friday, August 18, 2006 5:28
AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] How to set
EventListeners to undrawn components on a ViewStack?











Hi list,

I'm using a LinkBar with a ViewStack and on any of the ViwStack contents I
have a button that needs to get a MouseEvent listener.

When I start the app, I get an exception : Cannot access a property or
method of a null object reference. Because all the buttons on the
VieStacks
that have not yet been drawn are not defined for the AddEventListener.

Is there an easy workaround for this situation?

Thanks,
Sascha






__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___






RE: [flexcoders] How to set EventListeners to undrawn components on a ViewStack?

2006-08-18 Thread Sascha Balkau












Thanks Gordon!
Sometimes I dont see the easiest solution by myself! However Im
trying to keep MXML code and functionality code separate so Im wondering
if there is another workaround for this? Though I can live with your suggestion
in this situation.



Sascha

















From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon Smith
Sent: Saturday, 19. August, 2006
08:39
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] How to
set EventListeners to undrawn components on a ViewStack?





Why call addEventListener() yourself? If
you simply put an mouseDown or whatever event atttribute on your content item
in MXML, it should work fine; addEventListener() will get called for you when
the content item gets created.



- Gordon











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Sascha Balkau
Sent: Friday, August 18, 2006 5:28
AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] How to set
EventListeners to undrawn components on a ViewStack?











Hi list,

I'm using a LinkBar with a ViewStack and on any of the ViwStack contents I
have a button that needs to get a MouseEvent listener.

When I start the app, I get an exception : Cannot access a property or
method of a null object reference. Because all the buttons on the
VieStacks
that have not yet been drawn are not defined for the AddEventListener.

Is there an easy workaround for this situation?

Thanks,
Sascha





___ 








__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___