ActionScript 3.0 :: 1013: The Private Attribute May Be Used Only On Class Property Definitions
Apr 7, 2011This error is just making me wanna commit where have i gone wrong? Help would be awesomepackage classes
[Code]...
This error is just making me wanna commit where have i gone wrong? Help would be awesomepackage classes
[Code]...
I keep getting this error in my class file main.as this is a translator application. I was able to get the animations working at one point but now I am stuck with this error and I don't understand it.
main.as:
package
{
import flash.display.Sprite;
import flash.events.KeyboardEvent;
import flash.net.URLLoader;
[code].....
Here's my code:
[URL]
The errors are one line 123 and 128.I've googled the error, but I still can't fix it, it's got me baffled for an hour now! I've tried adding curly brace's but still same error. I left line 123 and 128 like this
function _update(e:Event):void
{
_helicopter.update(_mouseDown);
}
function onEnterFrame(e:Event):void
{'
But I'm getting an error stating that _update is not defined
I keep getting this error :1150 The protected attribute can only be used on class property definitions.
panel1.addEventListener(MouseEvent.CLICK, onClickPanel);
panel2.addEventListener(MouseEvent.CLICK, onClickPanel);
panel3.addEventListener(MouseEvent.CLICK, onClickPanel);
panel4.addEventListener(MouseEvent.CLICK, onClickPanel);
panel5.addEventListener(MouseEvent.CLICK, onClickPanel);
[Code]...
I'm customizing a floating panel that I found on gotoAndLearn.
View 2 RepliesI've been trying out a platform game and am focusing on the shooting aspect of it from a tutorial through youtube, the person doing the tutorial never explains the errors they fix between videos. I received an Error 1013 and I just can't figure it out, even looking at other codes.Line 29 is the issue.
ActionScript Code:[code]..........
I'm setting up functions in a document class file, then from there I am going to call that function from a movieclip in flash. For some reason, maybe I have things set up wrong, but it is throwing me errors such as below: Line 37 1013: The private attribute may be used only on class property definitions. What am I doing wrong here and is there something I am not understanding? Here is my .as code. modal.as > package
[Code]...
Okay so you've got your private vars in your AS2 Class, you think they're all safe right? Wrong.
Doing a trace(MyClass.myvar); will spit out an error that the var is private and you can't touch it.
But a trace(MyClass["myvar"]); will work perfectly fine. You can use it normal, without any setters getters outside the class.
Is there a way to protect against this? I think this is a huge security flaw. I know it's simple OOP, but a private var in an object should have rules.
In Actionscript 2 I find that I cannot have a "private function set" without returning the error "A member attribute was used incorrectly." If I change it to "public function set" I'm fine but that defeats the goal of trying to protect the function from setting externally
View 2 Repliesone thing i've never really understood about AS3 is that you can't have a private set method and a public get method together. from within my class i would like to assign values that would call a private set function:
[Code]...
is there no way to use the set keyword on a private function?
In my project I've defined a Point class to build Point objects. I also built a Polygon class with a (private) array property, Points. The polygon class contains a method getPoints() which return the current Points array. My objective is to built one or more Polygon objects and assign several Point objects to the Polygon's Points array. Let's say I've created two Polygon objects, plgPolygon01 and plgPolygon02. To both objects I insert three new Point objects into the Points array.
As I call the plgPolygon01.getPoints() method, i expect to get an array with three values. But when I do this, I get an array with six values. So I conclude: while I was inserting Point objects into the Points array of a Polygon object, this Points array seems to be public instead of private. Otherwise, I'd only get the Points I assigned to the first Polygon object and not all the Points assigned to polygons.
I'm accessing the classes from an externally loaded SWF so that I can "skin" SWF applications at runtime. Everything works fine but I'd like to make it as dynamic as possible and allow developers to access all the class definitions in a loaded SWF without having the FLA file or a list of their names.
[Code]....
This seems like it would be really easy but for some reason it's not working.
I have a class file, class DataSet, which right now only takes an XML file, parses it, and pushes the XML into an array:
The object is instantiated and an XML file is passed back to the object definition. If the XML file is successfully loaded, the class should then called the function parseXML() and put the data into the array.
But for some reason, parseXML() is never called. I have no idea why this isn't working, because the syntax checks out and I've seen millions of other files where functions call other functions.
Here's the class file:
[Code]....
I wrote two projects using the same 3D library but I modified it pretty heavily in one (to the extent that the inheritance is pretty different on one) - now I need to load one into the other and I'm getting some weird errors that look like the child swf is trying to use the same class definitions as the parent even though it should be in an entirely different namespace.
So - anyone have a tricky way of forcing the loaded swf to use the classes it's compiled with rather than the ones already defined in the parent swf (and vice versa) or do I need to refactor all my stuff?
So I know you can assign a base class to a library definition within the Movieclips library information field but If I have 30 items in the library and I change the Base class this becomes a pain in the ass, can this be done programmatically when I instantiate the library definition?
var new_shiz:MyItem1 = new MyItem1(); // Needs to have a generic base class of MyItem
I have an as3 component I made in CS3 and need to access the Component Definitions. Defining component parameters using the Inspectable Tag metod does not return success.
View 1 RepliesWorking in a very large Flash application, previously in AS2/CS3 I would have a setup like the following:
root.swf-- modules---- code_a.swf---- code_b.swf-- views---- view_a.swf---- view_b.swfUsing _exclude.xml files, I could exclude the classes defined in code_a and code_b from the ouptut .swf of view_a and view_b. root.swf would be responsible for loading the code modules before view_a or view_b, ensuring that class definitions that view_a and view_b depended on existed.
The Problem:We've recently migrated to using Actionscript 3/CS5. *_exclude.xml files no longer exist. To get the same functionality as above, I've tried the following: My setup now looks something like:
root.swf-- modules---- class_a.as---- class_b.as-- views---- view_a.swf---- view_b.swfUse mxmlc to compile root.swf, view_a.swf and view_b.swf, passing it -externs option to specify classes that will be loaded externally (the two classes in modules).
This ensures that the class is excluded from the compiled swf.Use compc to compile class_a.as and class_b.as into classes.swf, using -directory=true to access library.swf for external loading.However,when I try running one of the two view files which depend on classes.swf, I get runtime errors telling me that a class definition is not present.
Current Workaround
I've devised a workaround which I'm currently not happy with as it's backwards to the modular approach that I was previously using:Rather than loading the code modules, I statically link all class definitions required by child movies intoroot.swf. When building root.swf, I use the -link-report option of mxmlc to provide a list of included classes. When building child swfs, I can the use -load-externs to ensure that class definitions that already exist will not be included in the compile output.
Is there a way that anyone is aware of to replicate the AS2/_exclude.xml solution that I had using AS3/CS5?
have an RSS feed, within Flex I have connected to the feed via HTTPService, the XML structure is as follows (not exact, but for the purpose of the question). I am able to walk down the xml and access the data within the title and link nodes with success but when I get the the description node and try to access the img and src attributes within it, I haven't had any success. Reading about parsing with e4x the example I get is:
var xList:XMLList = xData.channel.item.description.(attribute("src"));
or
var xList:XMLList = xData.channel.item.description.(@src);
[code]......
here is a snippet of my code in an as file
ActionScript Code:
class PoolBall extends MovieClip {
private var poolBall:MovieClip;
[code].....
i have created a Vehicle.as file and a Car.as file which are in the same project. The problem i am having is trying to use the properties in my Car.as from my Vehicle.as file.Vehicle.as
Code:
package
{
[code]......
I've heard it's considered best practice to keep all class properties private and to change them using getter and setter methods.
View 5 RepliesI try to serialize objects with their private attributes, in Flex.
The introspection API does not seem to allow it:
"The describeType() method returns only public members. The method does not return private members of the caller's superclass or any other class where the caller is not an instance."
Is there another way for an instance to know the name of its private members?
I have a class which deals with a lot of visuals, which essentially are movieclips. So I have around 50 privately declared movieclips in the class. Would it be a good idea to put them in a dictionary and retrieve them by their name (as key) , put them in an array or just leave them as they are?
My issue is the visual look of my class right now with that many private members, looks like a mess visually.
I am writing class that extends adobe air PNGEncoder,
I want to use the writeChunk method, but it seems to be private static and i cant seems to use it with my code But it gives the error as below
[Code].....
I have some code from a CS3 app composed of the .FLA file with an .AS file for the class that had definitions for two private classes in it. Yesterday I brought the files into CS4 and noticed that they did not compile. Gives an 1120, access of undefined property and names a constant. I have reduced this problem down to bare bones and it still occurs, so it is a bug in CS4.
[Code]....
there are classes definitions where all their methods are private my question is why are they private, because i've tried a code wherein i changed all the private access modifier to public and nothing changed!
what if you make an instance of that class with all its method private, how are you be able to access that on another class. coz i know private methods are only accessible to the class where they are declared! will the instance of that class be able to access the superclass's private methods!
on private variables, it's still not clear to me as to why make a private variable and then use a getter and setter, when you can simply make it public! are these variables called static?cause on the way i understand it private functions and private variables are static?
I have a class that creates an array from a config xml file. I set a private variable in that class and use a getter in other classes to access the array. The routine that uses the array does the following:
- Call the getter and assign the returned value to a local (private) variable tmpArray. the getter is a simple return() using a value that is established in the constructor.
- Uses a for loop to itterate over the contents
- Uses array.shift() to pop the item in tmpArray
The next time I run the routine, the contents of the array is empty. I'm using the same getter. I implemented the getter when I tried to manage both arrays in the same class figuring that as long as the original array was private (i also tried static), that the value would not change. I have since worked around the problem by moving the routine that fills up the original value from the constructor to the getter. So, consider the following code:
import flash.events.Event;
btn.addEventListener("click", btnHandler);
var myArray = new Array();
var myTmpArray = new Array()
myArray = ["one", "two", "three"];
myTmpArray = myArray;
function btnHandler(evt:Event) {
[Code] .....
If I create a variable myVar and set it to 1 then set myOtherVar = myVar, the both equal the same value. If I change the value of myOtherVar, myVar is not affected. But using the shift() method changes both the original and the copied array.
I have .fla file where I have instantiated an object of a class( testclass.as ) like this in frame 1
[Code]...
Currently I have two classes which are "bullet" and "enemy".There are two instances of the enemy class.Code from an ENTER_FRAME event in the Bullet Class:
ActionScript Code:
try
{
for(var k:int=0; k<getEnemys.length; k++)
[code]....
The Enemy Class has a private variable called "hits".What do I have to do in order to reduce the hits of the instance of the enemy that was hit by the bullet?
These two functions are taken out of my as class file, even though the setInterval is never cleared it only calls generateParticles 1 time. Someone please help me figure this out. I have been messing around with it over an hour but still can find why its only called once. emit is a private var Number declared outside the function in the class.
[Code]...