Something I've been confused about for a while now is how to get components to "talk to one another" or perhaps more accurately access one another. For example in my application I have a component that contains the website banner, a component that contains the website footer a component that contains the sites main content area and a component that contains the top navigation of the site. All of these components are stored in a folder called components.
The problem however is in my main content component I make use of a module loader called "contentLoader" and in my navigation component I have buttons that I want to change the url/module of this loader. However when I apply the code click="contentLoader.url = 'page2.swf'" I get the error "Access Of Undefined Property contentLoader".
Is this because the two (the buttons and the module loader) are in seperate files and hence can't access each others data? Is exchanging data between controls that are in different component files tricky and requiring a lot of ActionScript or am I missing something?
I find it useful to seperate the components in this way as I've heard it can help performance and loading times but it seems there's more to it than I expected.
Can anyone direct me to a tutorial or give any advice on this? Any help is much appreciated
you can follow any framework to resolve your problem.
Otherwise you can add singleton class which will be bridge between your two classes.
Or you can create a variable of one class in other and access all the public methods and properties.
Hope this helps
Yep I think I know what you mean but it is actually putting that into practice that I struggle with. I've been scouring the internet for examples where one component talks to another. For example you click a button in one component and it changes a label to the label of the button you've just clicked in another component, things like that.