1, design ideas
Since flex does not set LinkButton background color properties, now has to start from two aspects: first, directly by calling the style method to draw the background color LinkButton, and second, set the LinkButton background picture. Here, the first method is described.
2. Design Source
<?xml version= "1.0" encoding= "Utf-8"?> <s:application xmlns:fx=
"http://ns.adobe.com/mxml/2009"
xmlns:s= "Library://ns.adobe.com/flex/spark"
xmlns:mx= "library://ns.adobe.com/flex/mx"
creationComplete = "Inithandler (event)" >
<s:layout>
<s:BasicLayout/>
</s:layout>
<fx: Script>
<![ cdata[
import mx.events.FlexEvent;
/**
* Initialization functions
/protected function Inithandler (event:flexevent): void
{
MyLinkButton.graphics.beginFill (0x00ff00);
MyLinkButton.graphics.drawRect (0,0,mylinkbutton.width,mylinkbutton.height);
MyLinkButton.graphics.endFill ();
}
] >
</fx:Script>
<fx:Declarations>
<!--place non-visual elements (such as services, value objects) here-->
</fx :D eclarations>
<mx:vbox width= "100%" > <mx:linkbutton id= "Mylinkbutton" label= "Query" x= "y="
"/>
</mx:VBox>
</s:Application>
3. Design result