加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flex 1114 The public attribute can only be used inside a pac

发布时间:2020-12-15 04:08:22 所属栏目:百科 来源:网络整理
导读:ActionScript Error #1114: The public attribute can only be used inside a package. Description: This ActionScript Error justs means that you have used the access control modifier ‘public’ in the wrong spot. There are four access control m

ActionScript Error #1114: The public attribute can only be used inside a package.

Description:
This ActionScript Error justs means that you have used the access control modifier ‘public’ in the wrong spot. There are four access control modifiers – public,private,internal,and protected. Each of these specify how the method or variable is accessed. Each access control modifier has it’s own error but they all mean the same thing. Access control modifiers need to be used in the right place. The ‘internal’ and ‘public’ can only be used inside a ‘package’ and ‘private’ and ‘protected’ can only be used on classes.

Fix:
Make sure to only use the ‘public’ access control modifier to define a method or variable within a package and not inside the class itself nor within a method(function).

Bad Code:

package{
 
  public class MySize {
 
     public function Connection():void{
 
        public var bgColor:uint = 0xFFCC00;
 
        trace(bgColor);
 
     }
 
  }
 
}

Good Code:
package{
 
  public class MySize {
 
     public var bgColor:uint = 0xFFCC00;
 
     public function Connection():void{
 
        trace(bgColor);
 
     }
 
  }
 
}

OR?


package{
 
  public class MySize {
 
     public function Connection():void{
 
        var bgColor:uint = 0xFFCC00;
 
        trace(bgColor);
 
     }
 
  }
 
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读