I have done this many times but can’t remember the syntax for the life of me and am obviously asking Google the wrong questions.
If I have an MXML file like this (MyExample.mxml):
<s:TitleWindow
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
<fx:Script>
<![CDATA[
]]>
</fx:Script>
</s:TitleWindow>
I can’t give the TitleWindow an id as it’s the top level component. How do I access the TitleWindow component from inside the script tag, the ‘this’ keyword will give me type Object, which one of its properties will give me the title window?
Cheers,
Chris
Use the
thiskeyword to refer to the top level component in your MXML Component file.If you want to access the actual Title Skin part, you can do so by accessing the titleDisplay skin part, most likely in a partAdded method.