0

I'm pretty new to Flex and I don't know how to solve this problem. I have 3 mxml components. In Component 1, I let the users fill in some data. In Component 3 I want to use the data, but I can't find a way to make it work.

Can someone help me, please? :)

I can show you code, but I think it would complicate the things a lot because it is data coming from a slider and the code is pretty long.

1 Answers1

2

I feel like I answer this question on a routine basis. What is your display hierarchy?

Here are a few common things:

  • If component3 is a child of component1; then just pass the data in using public variables
  • If component1 is a child of component3; then wrap the data in a custom event and dispatch that event from component1 up to component3.
  • If component1 and component3 have the same parent, then combine the previous two approaches. Wrap the data up in a custom event, dispatch it to the parent. Have the parent pass the data down into component3.
  • A lot of frameworks make use of singletons and/or dependency injection; to help share data between components in more complicated architectures.

A quick Google reveals these sources; which seem to cover similar ground and may help:

http://www.actionscript.org/forums/showthread.php3?t=120330

how to use mxml component in another actionscipt

Pass data between flex components

Community
  • 1
  • 1
JeffryHouser
  • 39,401
  • 4
  • 38
  • 59