flex4 1195 error when calling a function (not get or set)
I have a class called S3Uploader which extends Sprite, which has a private function init, which looks sometihng like this:
private function init(signatureUrl:String,
prefixPath:String,
fileSizeLimit:Number,
queueSizeLimit:Number,
fileTypes:String,
fileTypeDescs:String,
selectMultipleFiles:Boolean,
buttonWidth:Number,
buttonHeight:Number,
buttonUpUrl:String,
buttonDownUrl:String,
buttonOverUrl:String
):void {
//do stuff
}
In my flex app, I am trying to display the sprite and call the init function when the app is loaded. my code so far is this:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
initialize="init();">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, valu开发者_如何学Goe objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import S3Uploader;
function init() {
var s3upload:S3Uploader = new S3Uploader();
s3upload.init('/s3_uploads2.xml', '', 524288000, 100, '*.*', 'All Files', true, 100, 30, '/images/upload-button.png', '/images/upload-button.png', '/images/upload-button.png');
uploader.addChild(s3upload);
}
]]>
</fx:Script>
<s:SpriteVisualElement id="uploader" />
</s:Application>
however, on the line where i call s3upload.init, i get a 1195 error saying "1195: Attempted access of inaccessible method init through a reference with static type S3Uploader."
When i looked up this error, it seems like almost everyone getting this was trying to call a function with set or get. However, I am not doing this and i have no idea why i am getting this error. Does anyone know what I am doing wrong?
You should learn the basics of OOP. You cannot call private
functions from not within function owner objects. Mark it as public
.
精彩评论