Flex: Passing Data with Custom Events

On March 4, 2009, in Flex, by Anuj Gakhar

A reader asked me a question based on my earlier post about how to maintain Login information in Flex and how to pass data along with Custom Events.

So, I decided to write up this post. I have written a simple example which does the following :-

1) Display a Login form with Username/Password fields.
2) Calls a AuthService for authentication on Click of the Login Button.
3) The AuthService fires a Custom Event if login successful and sends across the user details along.
4) The Main Page listens to the Event and sets the User details in a Static class for use anywhere in the Flex app.
5) The page changes its state when user is logged in.

The View Source is enabled on the example so feel free to look at or download the code. I hope this example helps answer the question here.

Tagged with:  

2 Responses to Flex: Passing Data with Custom Events

  1. […] *** 在Flex3中生成PDF 在FlashCS4中创建原生的和非原生的AIR右键菜单 Flex:使用自定义事件传递数据 在TextInput组件中强制大写 […]

  2. Gautam says:

    Very helpful example. Thanks! I was looking for a simple example to understand custom events and data transfer in Flex.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2011 Anuj Gakhar