Pessoal, estou no FLex 4 e preciso adicionar um componente na tela(nao dentro de outro componente) com AS mas não estou conseguindo.
Tentei com esse codigo:
<?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"
minWidth="955" minHeight="600"
creationComplete="inicio()" >
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.controls.Button;
public function inicio():void
{
var botao:Button = new Button();
botao.x = 300;
botao.y = 250;
this.addChild(botao);
}
]]>
</fx:Script>
</s:Application>
Mas não deu certo.
O que estou fazendo de errado ??
Falta alguma coisa ?!
Valeu!