Each MXML file is its own document/variable scope. You have to have a
reference from the main app to the mxml component and then access its public
Thank you for your reply,and i know about scope(my background is c#).Yes,i am referencing the component MXML from the main file through
xmlns:components = "components.*",yet i can't access anything from my main MXML.
What is else strange,i tried accessing functions from other components,and they are just not visible.So,i created a new test project and i can't access it there either.
I know i am making some stupid mistake,but i would really appreciate if you could help me.
I believe that what the previous poster was trying to explain is that first you instantiate your component:
var myComponent:MyComponentClass = new MyComponentClass();
and only then can you call the method:
Alternately, you could make the function static.
I tried your solution,but it does not work.I need to be able to call my onAppComplete function defined in MXML component in CreationComplete
event in my main file.The problem is that i don't know how to reference the component file,so it becomes visible to the main file.
How are you declaring the MXML component in the main app?
I am sure that i'm doing everything wrong.Please let's say that my component is called component1 and i need to access its methods,what would the
code look like?
Thank you very much,
I am sorry,english is not my first language so i didn't made my question clearer.I need to be able to call onAppComplete function that i wrote in one MXML
component,and i need it to be called in CreationComplete event of the main application file.I think my question is now a little clearer.
Thanks for your time,
1 person found this helpful
Showing code will help. If th custom component as an id="component1" then
Assuming that there is a public function called onAppComplete
Thank you for your advice,but my mind was not working very good,anyway i called my onAppComplete function directly in the components CreationComplete click event.
I thought it would be possible to call it from the main file(applications CreationComplete event),but i haven't found a way.In any case,thank you.