Version 2, last updated by judah at Sep 11 08:13 2009 UTC
Setting the Page Title
If we want to set the page title we can do that a couple of different ways. One method is to set the page name in the State Options as shown below:
<managers:LinkManager projectName="ACME Inc." defaultFragment="start" isTitleBeforeProjectName="true">
<managers:stateOptions>
<vo:StateOption stateName="about" displayName="About"/>
<vo:StateOption stateName="contact" displayName="Contact Us"/>
<vo:StateOption stateName="products" displayName="Our Products"/>
<vo:StateOption stateName="services" displayName="Our Services"/>
</managers:stateOptions>
</managers:LinkManager>
We enter the name of the state and then the name of the page.
We can also set the page title in the pageTitle property of a Link component. For example,
<controls:TextLink text="Contact Us" id="contactUsLink1" hyperlink="contact" pageTitle="Contact Us"/>
When we set the page title in a text link the page title will be displayed in the tooltip if the tooltip is not set.
We are setting the isTitleBeforeProjectName to true. This changes the full title from "Project Name - Page Name" to "Page Name - Project Name". If you want to arrange it differently then do not specify a project name and set the page title to what you desire or vice versa.
An example and code of our site is shown below:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
color="#333333"
backgroundColor="#ffffff"
backgroundGradientColors="[#ffffff, #ffffff]"
backgroundGradientAlphas="[1, 1]"
themeColor="#CCCCCC"
xmlns:managers="com.flexcapacitor.managers.*"
xmlns:controls="com.flexcapacitor.controls.*"
xmlns:vo="com.flexcapacitor.vo.*">
<managers:LinkManager projectName="ACME Inc." defaultFragment="start" isTitleBeforeProjectName="true">
<managers:stateOptions>
<vo:StateOption stateName="about" displayName="About"/>
<vo:StateOption stateName="contact" displayName="Contact Us"/>
<vo:StateOption stateName="products" displayName="Our Products"/>
<vo:StateOption stateName="services" displayName="Our Services"/>
</managers:stateOptions>
</managers:LinkManager>
<managers:ContextMenuManager/>
<managers:MouseWheelManager />
<controls:TextLink x="10" y="10" text="ACME Inc." fontWeight="bold" fontSize="36" hyperlink="start"/>
<mx:HBox x="10" y="68" id="hbox1">
<controls:TextLink text="Home" id="homeLink1" hyperlink="start"/>
<controls:TextLink text="Products" id="productsLink1" hyperlink="products"/>
<controls:TextLink text="Services" id="servicesLink1" hyperlink="services"/>
<controls:TextLink text="Contact Us" id="contactUsLink1" hyperlink="contact"/>
<controls:TextLink text="About" id="aboutLink1" hyperlink="about"/>
</mx:HBox>
<mx:Text y="100" id="text1" fontWeight="bold" text="base" left="10"/>
<mx:VBox y="130" id="vbox1" left="10" right="20">
<mx:HBox width="100%" id="contentBox1">
</mx:HBox>
<mx:HBox width="100%" horizontalAlign="center">
<mx:Text text="Copyright 2009 Flex Capacitor" fontWeight="bold" fontSize="10" fontFamily="Arial"/>
</mx:HBox>
</mx:VBox>
<!-- STATES -->
<mx:states>
<mx:State name="{ABOUT}">
<mx:SetProperty target="{text1}" name="text" value="About"/>
<mx:AddChild relativeTo="{contentBox1}" position="lastChild">
<controls:TextAutoSize width="100%" source="content/about.txt"/>
</mx:AddChild>
</mx:State>
<mx:State name="contact">
<mx:SetProperty target="{text1}" name="text" value="Contact"/>
<mx:AddChild relativeTo="{contentBox1}" position="lastChild">
<controls:TextAutoSize width="100%" source="content/contact.txt"/>
</mx:AddChild>
</mx:State>
<mx:State name="products">
<mx:SetProperty target="{text1}" name="text" value="Products"/>
<mx:AddChild relativeTo="{contentBox1}" position="lastChild">
<controls:TextAutoSize width="100%" source="content/products.xml"/>
</mx:AddChild>
</mx:State>
<mx:State name="services">
<mx:SetProperty target="{text1}" name="text" value="Services"/>
<mx:AddChild relativeTo="{contentBox1}" position="lastChild">
<controls:TextAutoSize width="100%" source="content/services.txt"/>
</mx:AddChild>
</mx:State>
<mx:State name="start">
<mx:SetProperty target="{text1}" name="text" value="Home"/>
<mx:AddChild relativeTo="{contentBox1}" position="lastChild">
<controls:TextAutoSize width="100%" source="content/welcome.txt"/>
</mx:AddChild>
</mx:State>
</mx:states>
</mx:Application>