I declared a namespace at the top of my mxml file Radio.mxml;
xmlns:jour="components.journal.*"
I now have another mxml file Journal.mxml is under the components/journal folder,the Radio.mxml is at the root folder which contains the components folder.
Now I want to access the Journal.mxml in the Radio.mxml using the name space,how could I do that,I've tried
var a = new jour.Journal();
but it seems not right,could anyone help a li开发者_运维知识库ttle bit?Many thanks.
xmlns:jour="components.journal.*"
only defines the namespace for you mxml components. So you can do something like: <jour:Journal id='my-journal' />
.
If you want use your Journal
class inside of your actionscript, you'll need to import it seperately: import components.journal.Journal
then use it like var a = new Journal();
It sounds like you're on the right track, but there is a slight disconnect. You're mixing MXML and ActionScript syntax I think.
In ActionSCript you can do this:
import components.journal.Journal;
var a : Journal = new Journal();
In MXML, you would do something like this:
<TopLevelComponent xmlns:jour="components.journal.*">
<jour:Journal />
</TopLevelComponent>
I do not believe that ActionScript can reference the namespace you define in MXML.
精彩评论