我是ActionScript和Flash / Flex的新手。
我正在尝试实现多文件上传器并为javascript公开和API。虽然我认为我可以处理urlrequests,但我很难制作一个SimpleButton。
我希望按钮具有我创建的movieclip / sprite的大小。我正在努力制作130px x 30px的动画片段,并且有一个简单的按钮可以填满整个区域。
我在动作中尝试做什么:
private var _button:SimpleButton = new SimpleButton();
private var _fileList:FileReferenceList = new FileReferenceList();
private var _buttonShape:Shape;
public function FileUploader() {
makeSkin();
makeButton();
addChild(_button);
}
private function makeSkin():void {
_buttonShape = new Shape();
_buttonShape.graphics.beginFill(0x000000,1);
_buttonShape.graphics.drawRect(0,0,130,30);
_buttonShape.graphics.endFill();
}
private function makeButton():void {
_button.upState = _buttonShape;
_button.downState = _buttonShape;
_button.overState = _buttonShape;
_button.hitTestState = _buttonShape;
_button.addEventListener(MouseEvent.CLICK, clickAction);
}
private function clickAction(e:MouseEvent):void {
_fileList.browse();
}
HTML:
<object id="FileUploader" width="130px" height="30px">
<param name="movie" value="FileUploader.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#FFFFFF" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<object type="application/x-shockwave-flash" data="FileUploader.swf" width="130px" height="30px" >
<param name="quality" value="high" />
<param name="bgcolor" value="#FFFFFF" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
</object>
</object>
我正在使用intelij来编译它。我不知道如何使用SDK单独构建它。任何教程或提示都将不胜感激。谢谢!
答案 0 :(得分:1)
您可以下载FlashDevelop或FDT Free作为IDE +编译器。我更喜欢FlashDevelop,因为它很简单,可以让所有东西都能正常工作。但是,FDT和FlashDevelop都有模板可以从中开始。
答案 1 :(得分:0)
我在阅读了一些之后找到了答案。阶段规模和阶段对齐是问题。
public class FileUploader extends Sprite {
private var _fileList:FileReferenceList = new FileReferenceList();
private var _buttonShape:Sprite = new Sprite();
public function FileUploader() {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
createButton();
addChild(_buttonShape);
}
private function createButton():void {
_buttonShape.x = 0;
_buttonShape.y = 0;
_buttonShape.graphics.beginFill(0x000000,1);
_buttonShape.graphics.drawRect(0,0,1000,1000);
_buttonShape.graphics.endFill();
_buttonShape.buttonMode = true;
_buttonShape.addEventListener(MouseEvent.CLICK, clickAction);
}
private function clickAction(e:MouseEvent):void {
_fileList.browse();
}
}