Flex 3 UI ActionScript 编程入门 [英] Getting Started with Flex 3 UI ActionScript Programming
问题描述
在 ActionScript 中开始 Flex 3 UI 编程有什么好的资源吗?如果有人有任何想法,我在以下方面遇到了一些问题.它的大小合适,但我的按钮没有显示.有人有什么想法吗?
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);
}
}
}
推荐答案
对于真正的 Flex 应用程序,我认为您需要从顶级 mx.core.Application
(通常在 MXML 中定义)开始而不是 ActionScript),您可以向其中添加 mx.core.UIComponent
s.我认为您的 PhotoUploader
将是自定义 UIComponent 的一个很好的例子.
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.UIComponent
s. I think your PhotoUploader
would be a good example of a custom UIComponent.
Flex 帮助/教程 页面非常好.我建议从那里开始.自定义组件 已明确涵盖,但您可能希望更早开始流.
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屋!