Question

How can I specify the package of an MXML file? I can easily set the package of an ActionScript class by just wrapping it with a package declaration, but how do I do the same thing in an MXML file?

The problem I have is that I'm not able to use MXML files that are not in the same folder as the main MXML file. For structure, I want to create subfolders as such:

src
    mycompany
        myproject
            gui
                screens
                    Screen1.mxml
                    Screen2.mxml
                Main.mxml

If I want to use Screen1.mxml in Main.mxml, how do I do that? I want Screen1.mxml to be in the package "mycompany.myproject.gui.screens" but I don't know how to specify that.

If I managed to put Screen1.mxml in that package, i guess I would just use it in Main.mxml as such:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:screens="mycompany.myproject.gui.screens">
    <mx:Canvas>
        <screens:Companies id="screenCompanies" />
    </mx:Canvas>
</mx:Application>

Please correct me if I'm wrong about that...

I'm using FlashDevelop as my IDE and building with Flex 3.3.

Was it helpful?

Solution

You're almost correct. The correct namespace declaration:

xmlns:screens="mycompany.myproject.gui.screens.*"

Usage:

<screens:Screen1 id="screenCompanies" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top