开发者

How to make a some button on web form with Action Script

开发者 https://www.devze.com 2023-01-09 10:08 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消