привет Я только начинаю изучать гибкий и сценарий действий. может кто-то сказать мне, что я делаю неправильно в этом коде.Как добавить кнопку в качестве
public function createBoxes():void
{
//create a Panel
var colorsPanel:Panel = new Panel(); colorsPanel.layout = "absolute"; colorsPanel.width = 250; colorsPanel.height = 250;
//add the Panel to the Application
addElement(colorsPanel);
//create a red box
var redBox:Canvas = new Canvas(); redBox.x = 70; redBox.y = 70; redBox.width = 50; redBox.height = 50; redBox.setStyle("backgroundColor", 0xFF0000);
//create a green box
var greenBox:Canvas = new Canvas(); greenBox.x = 90; greenBox.y = 90; greenBox.width = 50; greenBox.height = 50; greenBox.setStyle("backgroundColor", 0x00FF00);
//create a blue box
var blueBox:Canvas = new Canvas(); blueBox.x = 100; blueBox.y = 60; blueBox.width = 50; blueBox.height = 50; blueBox.setStyle("backgroundColor", 0x0000FF);
//add the boxes to the Panel
var Button:spark.components.Button = new spark.components.Button(); Button.x = 120; Button.y = 60; Button.label ="removeG";
colorsPanel.addElement(redBox);
colorsPanel.addElement(greenBox);
colorsPanel.addElement(blueBox);
colorsPanel.addElement(Button);
}
благодаря
В чем проблема ** **? Не компилируется? Не ___? –
Что не так с вашим кодом? Я просто тестировал, и он работает хорошо, поэтому проблема, вероятно, в другом месте. – sch
извините, я не знаю, что произошло, но теперь оно работает :)) – Max