Let’s consider an example
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:local="*">
<s:Button id="button""/>
</s:WindowedApplication>
By detault mxml compiler makes “button” a public field of the generated class.
Is it porribie to force it to make it a private field ?
You can’t make it private using plain MXML.
Nevertheless, there is a hacky way – removing the “id” property will effectively make it private. If you still need reference to the object, you should add a “creationComplete” handler and keep the reference from the event target.
This effectively the same as a private “button” in your example.