Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flex > Flex 2, 3 & 4

Thread Tools Rate Thread Display Modes
Old 04-16-2009, 03:25 PM   #1
Matt Wells
Registered User
Join Date: Jan 2009
Posts: 9
Default [Flex3] Error 1114: The public attribute can only be used inside a package.

I have been writing some base classes in AS that handle a lot of the basic functinality across some common components. I have come across this error "1114: The public attribute can only be used inside a package." I will post snippits of the code that I think a causing the problem but I still don't understand what the problem is, most of the documentation I have found doesn't seem relivent.

<?xml version="1.0" encoding="utf-8"?>
<EditorBase xmlns="com.my.components.*" xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Panel title="My Panel">
    <!-- Lots of MXML here -->

      <mx:Button label="Save" activate="dispatchSave()"/>
      <mx:Button label="Close" activate="dispatchClose()"/>
The error happens on both the button's activate event. Both dispatchSave() and dispatchClose() methods are defined on the EditorBase class which looks like this:

ActionScript Code:
package com.my.components {   import com.my.events.SaveEvent;   import mx.containers.Canvas;   import mx.events.CloseEvent;   [Event(name="save",type="com.my.events.SaveEvent")]   [Event(name="close",type="mx.events.CloseEvent")]   public class EditorBase extends Canvas {     public function EditorBase() {       super();     }     // Lots more AS here     public function dispatchSave():void {       dispatchEvent(new SaveEvent(SaveEvent.SAVE, false, false, _dataProvider));     }     public function dispatchClose():void {       dispatchEvent(new CloseEvent(CloseEvent.CLOSE));     }   } }

Can anyone make any sergestions as to what might be wrong?
Matt Wells is offline   Reply With Quote
Old 04-17-2009, 01:29 PM   #2
Senior Member
Join Date: Apr 2009
Posts: 114

i think it's because your function is associated with the canvas package, and the button is trying to access it.

you might want to try extending the canvas in MXML. then the buttons that you put inside it will have access to the canvas' public functions for sure.
JeTSpice is offline   Reply With Quote
Old 04-21-2009, 11:57 AM   #3
Matt Wells
Registered User
Join Date: Jan 2009
Posts: 9

I worked out what the problem was, I had left an opening brace inside an MXML attribute which I hadn't closed which caused the ActionScript to think everything was part of the function to run when the event was triggered.
Matt Wells is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
question about custom events dispatching dub_beat ActionScript 3.0 17 05-01-2008 12:52 PM
[AS3] 3D game using flash cs3 and actionscript 3 manoskouf Gaming and Game Development 19 04-10-2008 04:41 PM
Problems calling Public Functions tsquini ActionScript 3.0 3 04-08-2008 08:12 PM
Associating event.currentTarget back to it's class instance? pinkshiro ActionScript 3.0 0 01-14-2008 02:42 AM
Reusable class ... ? xxlm ActionScript 2.0 3 01-18-2006 03:29 AM

All times are GMT. The time now is 11:21 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.