I’m really novice with ActionScript and Flash/Flex.
I’m trying to implement a multiple file uploader and expose and API for javascript. Even though I think I can handle urlrequests, I’m having a hard time making a SimpleButton.
I want the button to have the size of the movieclip/sprite that I create. I’m trying without luck to make a movieclip of 130px x 30px, and have a simple button that fills the entire area.
What I try to do in actionscript:
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>
I’m using intelij to compile this. I have no idea how to build it with the SDK alone. Any tutorial or hint would be grateful. Thanks!
I have found the answer after reading a bit more. Stage scale and stage align were the problem.