I am absolute beginner in Flash, and AS3. I need to make dynamically some amount of buttons in web page. I must use Action Script and MXML. If It will be PHP I will call echo function.
So help me please.
I am absolute beginner in Flash, and AS3. I need to make dynamically some amount of buttons in web page. I must use Action Script and MXML. If It will be PHP I will call echo function.
So help me please.
In AS you can use the class RemoteObject (example with amfphp) to communicate with the server. Then you can send an Xml or anything else to describe your GUI.
In actionscript you can add components to container like this:
var horizontalContainer:HBox = new HBox();
horizontalContainer.percentWidth = 100;
addChild(horizontalContainer);
var btn:Button = new Button();
horizontalContainer.addChild(btn);
btn.label = "Click me !";
btn.addEventListener(MouseEvent.CLICK, btnClickHandler);
private function btnClickHandler(e:MouseEvent):void {
// Do what you want
}
You can do a loop to add multiple buttons. HBox is the layout of the container. You have multiple type of layouts in Flex. I advise you to do a lot of tutorial to learn the basics of Flex.