tags:

views:

14

answers:

1

I have one .mxml file (the Application) with a ViewStack (with 4 views) and a ControlBard, obviously I can change the views with it, but what I want to do is: in view #1 I have an image which I want to convert to a "hyperlink", so when I click it I go to View #2, is this doable? Also I would like to pass somehow some data (like a String) to that View #2 (lets say the it's a user avatar I click so I want to go to the second view which will show me his profile, that's why I need his name/id).

A: 

One way, loosely coupling, Create a custom event (SelectAvatarEvent?) with a property for name/id and dispatch it from View1 when the link is clicked. In the Application add an event listener for this custom event, and catch it, change the view index to View2 and create a function/property in View2 that you can pass the string/event to. Depending on how it is implemented, might need to account for delayed instantiation of View2.

David Collie