
184 Create a Custom Component
The layout should look similar to the following example:
5. Switch to MXML editor’s Source mode by clicking the Source button in the editor’s
toolbar.
Flex Builder inserted code in your application so that it looks like the following:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" xmlns:ns1="myComponents.*">
<mx:Panel x="20" y="20" width="375" height="300" layout="absolute"
title="Main Application Window">
</mx:Panel>
<ns1:LoginBox x="20" y="20">
</ns1:LoginBox>
</mx:Application>
When you dragged the custom component into the MXML file, Flex Builder defined a
new namespace called ns1, and then inserted an
<ns1:LoginBox> tag after the
<mx:Panel> tag.
6. Save the file, wait until Flex Builder compiles the application, and click Run in the toolbar.
If you’re using the plug-in configuration of Flex Builder, select Run > Run As > Flex
Application.
Comentários a estes Manuais