入门使用Flex 3的UI ActionScript编程 [英] Getting Started with Flex 3 UI ActionScript Programming

查看:144
本文介绍了入门使用Flex 3的UI ActionScript编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有启动Flex 3的UI编程在ActionScript任何好的资源?我有以下的一些问题,如果任何人有任何的想法。它得到正确的大小,但我的按钮都没有显示出来。任何人有什么想法?

 包
{
    导入flash.display使用*。

    进口mx.controls.Button类;
    进口mx.controls.TileList;
    进口mx.controls.sliderClasses.Slider;
    进口mx.controls.ProgressBar;

    进口类flash.net.FileReferenceList;

    [SWF(宽度=720,高度=480,的backgroundColor =#FFFFFF,帧率=30)]

    公共类PhotoUploader扩展Sprite
    {
    VAR AddPhotosButton:按钮;
    VAR RemovePhotoButton:按钮;
    VAR UploadPhotosButton:按钮;

    公共职能PhotoUploader():无效
    {
    在Stage.scaleMode = StageScaleMode.NO_SCALE时;
    stage.align = StageAlign.TOP_LEFT;

    AddPhotosButton =新按钮();
    AddPhotosButton.x = 10;
    AddPhotosButton.y = 10;
    AddPhotosButton.width = 100;
    AddPhotosButton.height = 20;

    RemovePhotoButton =新按钮();
    UploadPhotosButton =新按钮();

    的addChild(AddPhotosButton);
    的addChild(RemovePhotoButton);
    的addChild(UploadPhotosButton);
    }
    }
}
 

解决方案

对于一个真正的Flex应用程序,我想你需要开始一个顶级 mx.core.Application (通常在MXML而不是ActionScript中定义),为您将增加 mx.core.UIComponent在秒。我想你的 PhotoUploader 将是一个自定义UIComponent的一个很好的例子。

借助 Flex帮助/教程页都相当不错。我建议你​​开始在那里。明确覆盖 自定义组件,但你可能想早些时候开始流。

Are there any good resources for starting Flex 3 UI programming in ActionScript? I am having some issues with the following if anyone has any ideas. It gets the right size, but my buttons are not showing up. Anyone have any ideas?

package 
{
    import flash.display.*;

    import mx.controls.Button;
    import mx.controls.TileList;
    import mx.controls.sliderClasses.Slider;
    import mx.controls.ProgressBar;

    import flash.net.FileReferenceList;

    [SWF(width="720", height="480", backgroundColor="#ffffff", framerate="30")]

    public class PhotoUploader extends Sprite
    {
    	var AddPhotosButton:Button;
    	var RemovePhotoButton:Button;
    	var UploadPhotosButton:Button;

    	public function PhotoUploader():void
    	{
    		stage.scaleMode = StageScaleMode.NO_SCALE;
    		stage.align = StageAlign.TOP_LEFT;

    		AddPhotosButton = new Button();
    		AddPhotosButton.x = 10;
    		AddPhotosButton.y = 10;
    		AddPhotosButton.width = 100;
    		AddPhotosButton.height = 20;

    		RemovePhotoButton = new Button();
    		UploadPhotosButton = new Button();

    		addChild(AddPhotosButton);
    		addChild(RemovePhotoButton);
    		addChild(UploadPhotosButton);
    	}
    }
}

For a true Flex application, I think you need to start with a top level mx.core.Application (often defined in MXML rather than ActionScript), to which you would add mx.core.UIComponents. I think your PhotoUploader would be a good example of a custom UIComponent.

The Flex help/tutorial pages are quite good. I'd recommend starting there. Custom components are covered explicitly, but you might want to start earlier in the stream.

这篇关于入门使用Flex 3的UI ActionScript编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆