ActionScript 3.0 :: Is It Really THAT Bad To Use Public Properties

Jul 26, 2011

So the reason I'm asking is..I have like 2000+ lines of code in 5 different separate classes. And they ALL have public properties and methods (as in, ALL the properties and methods are public). This is a fairly complex tile game 2d platformer. And yet everything is working fine. From what I've read, it seems that it 'MAY' cause problems later, where you might make a mistake and call a property twice, or call it 'wrongly', which then 'MAY' cause a bug that would be hard to backtrack.

There are surely many other reasons why not to do this..but if everything is working smoothly so far, should I really go back and try to make every variable private and recode this engine before I get to far?

View 8 Replies


Similar Posts:


Actionscript 3 :: Is There Any Advantage To Using Properties Over Public Variables

Jun 14, 2011

This might be a very stupid question, but I have to ask it anyway. I am graduating in about a month and while studying, I have always been taught to use properties instead of public variables. So I started wondering what the advantage was and I must say that in some cases, I have no clue at all. Of course it is handy when some other logic needs to be executed when setting properties or getting properties, but is there any advantage to using properties when you are only getting/setting a variable? An example of what I mean is shown below (As3).

[Code]...

View 2 Replies

Actionscript 3 :: Overriding Properties Of Public Field?

Aug 6, 2011

I have a custom button with a textfield inside:

package com.company.utils.ui
{
import flash.display.Shape;

[Code].....

But my problem is that I need to do something else (call a private customButton private method) when I assign a text to label.

playButton.label.text = "myText";

View 2 Replies

Flex :: Access The Public Properties And Methods Of A Loaded SWF

Mar 18, 2011

How would you go about calling the public properties and methods of a SWF you load in actionscript?

I have been using stackoverflow for years to answer my programming questions so I wanted to give back by writing a guide to an issue I had a lot of trouble figuring out. This is my first user guide so tell me if there is anything I can do to improve it.

View 3 Replies

ActionScript 3.0 :: Classes - Why Static’s (not Available To Any Instances) Properties And / Or Methods Can Have A Public

Feb 17, 2009

I have a question about classes. I just learn that static means that functions and/or properties are specifics to a class, but is it a synonym of private? And why statics (not available to any instances?) properties and/or methods can have a public (available anywhere else (timeline)) access modifier? PS: I just start with classes.

View 6 Replies

ActionScript 3.0 :: Unable To Access The Public Properties Of Custom Class

Nov 28, 2008

i wonder why i am unable to access the public properties of this custom class the public var w:Number; and the Public var h:Number; i am tracing them and on an instance of the PreLoader() Class.. and ia m getting NAN;

View 12 Replies

Flex :: Getter And Setter Methods Versus Public Properties

Jul 27, 2009

Which is a much better practice in binding a value in Flex?

View 2 Replies

ActionScript 3.0 :: Private Static Properties With Public Static Getters/setters

Oct 22, 2009

how bad is this practice? I am having trouble getting to some stuff so i am taking the easy way out

Code:
private static var _interrupted:Boolean;
public static function setInterrupted(value:Boolean):void{
_interrupted = value;
}

View 1 Replies

ActionScript 3.0 :: Use Public Variables Or Public Static Variables?

Feb 4, 2010

is it better to use public variables or public static variables?

View 6 Replies

ActionScript 2.0 :: Set Properties - Get Properties - Change An Mc Name Dynamically?

Sep 14, 2005

Just been playing around with the tutorials, on the Set properties/Get properties. Everything is all cool, except the "instance name" aspect. I dnt really understand that too well. Is it possible to change an Mc Name dynamically? If you look at my FLA when you hit the top left red button you will get a trace of the mcName as "square". Now if you input a new mc Name on the right hand side, you will see it change on the left hand side. But i want to know why it doesnt remain as the new mc Name, it still goes back to square.

View 3 Replies

ActionScript 2.0 :: Trace The Properties Of An Object's Properties?

Jan 30, 2008

I forgot to put it in the title so I'll just place it here; I am using AS 2.0. I know that there are other ways to accomplish the goal that am after, but I was wondering if anyone knows of a way to access the properties of an object's properties?

Here is the code that I thought of, even though it doesn't work

var a:Object = new Object();
a.bproperty = 0; //lowerlevel properties
a.cproperty = 1; // lowerlevel properties

[Code].....

This really just boils down to how I am organizing the code(I have ideas on what do next, and i am 99% sure that I can get them to work), and if there is a way to dynamically access the properties of the objects properties, It will save me from creating yet another large block of code for my project. If you want to see the unfinished project, go to [URL]

View 3 Replies

ActionScript 3.0 :: How To Run A Public Function

Sep 26, 2010

How can I run a public function in the DocumentClass?

View 4 Replies

Accessing A Public Variable Between Classes?

May 25, 2009

I've got two classes running...one is a document class (EgoGame.as) and another is a class linked to several similar movie clips (Ball.as).I'm trying to access a public variable from Ball.as which has been declared in the doucment class EgoGame.as.When I run the test the outputs states the following...1120: Access of undefined property _ballPlaced.Here's my code.  What I'm trying to do is remove the event listeners from the Ball.as when the _ballPlaced variable is true, so that the user can't drag and drop the balls after they've been placed in a zone.

Document ClassEgoGame.as
package
{

[code].....

View 3 Replies

Using Public Variable From Document Class

Jun 9, 2009

I've created 2 public variables in my Document Class...
 
public var _wall1:Wall=new Wall();public var _wall2:Wall=new Wall();I've then added them to the stage and given them relevant instance names...
  
stage.addChild(_wall1);_wall1.x=32; _wall1.y=510;_wall1.name = "wall1";I then want to use these variables in another Class (Ball.as). They need to be accessed in a function within the Ball Class constructor.
  
function bubble(event:Event):void{if(this.hitTestObject(_wall1)){    this.x += 1;}else if(this.hitTestObject(_wall2)) {    this.x -= 1;}However, the following Error message keeps appearing...
  
1120: Access of undefined property _wall1.1120: Access of undefined property _wall2.Any pointers? Do I need to import something into the Ball Class to point to the _wall# public variables in the Document Class?

View 1 Replies

ActionScript 3.0 :: Return A Value From A Function To Public?

Sep 26, 2008

there is an interesting problem here:

How to return a value from a function to public?

Here is the code:
var df:String; //i declared it here
function onResult(e :OperationEvent):void
{
df = e.data.toString(); // i set it here

[Code]...

View 5 Replies

Professional :: Lost In Public Method

Jul 12, 2010

I have a MainClass on a FLA file that defines both public, private, statics or not, properties and methods.I also have a package named 'components' that stocks Sprite sub-classes for my movie exportable clips. In one of them, I use the "this.root" property to access my main class instance elements at runtime.When I access public method references, same thing, I can trace them and have a true reponse to the question : [myPublicMethod is Function] ? BUT, when I want to execute the public methods, like MainClass (this.root). myPublicMethod(), the compiler boldly throws this at me :Error 1195: Attempted access of inaccessible method myPublicMethod through a reference with static type MainClass.

View 1 Replies

Media Server :: FMS Using A Public Ip (not Working)?

Dec 6, 2011

I was making live streaming using FMLE and FMS but inside a local network,  now my server is using a public ip, and now the FMLE cant connect to the server, im sure i have to change something in the FMS but i dont know where, if i try to work inside my network works, but if i try to do it by my public ip launch an error eerytime i try to connect.for example: inside my network my server ip was 192.168.1.200,  so everytime my FMLE needed the url to stream was something like.. rtmp://192.168.1.200/live. 

lets pretend that my new server ip is 190.15.15.103 so im trying to connect with FMLE to rtmp://1990.15.15.103/live.. and nothing happend, i also tryed using some ports.. like 1935.80.8888.1111 and nothing happened.

View 5 Replies

Flex :: Set A Public Var In A Popup Window?

Feb 9, 2011

I am trying to set a variable in a titlewindow pupup and use it in a script section. The variable is not being set and I don't know why. Here is my Main.mxml file:

[Code]...

View 2 Replies

Actionscript 3 :: Overriding A Public Variable With Set?

Oct 17, 2011

I have a base class like this

class Base {
public var space:Number;
}
which gets extended by
class Desc extends Base {

[Code]...

This doesn't compile. Say, you don't have control of the base class, what ways is there implement the same thing? The obvious is create a function setSpace(), but this object is being embedded in an already existing system that use the public space.

View 2 Replies

ActionScript 3.0 :: Have A Class With Public Function?

Jan 14, 2009

Is it possible to have a class with a public function [code]...

View 8 Replies

ActionScript 3.0 :: What Does Public And Private Mean In This Statement

Jan 25, 2009

what does public and private mean in this statement and when do I need to use it?this is not my code just using it as an example.

package {
import flash.display.Sprite;
import flash.net.URLRequest;
import flash.net.URLLoader;

[code]...

View 5 Replies

ActionScript 3.0 :: Display An Variable To The Public?

Oct 7, 2010

display an variable to the public, also use variable in middle of string.

ActionScript Code:
Exampel 1:
var i:Int = 0;
"show" Int
ActionScript Code:

[Code]...

View 9 Replies

ActionScript 3.0 :: Declaring A Movieclip Public?

Jun 16, 2011

I have this little flash movie, that goes full screen when you launch it, there's a big button in the middle that says "Press here", when you press it the screen goes black, and a movie starts playing.

When I run this NOT in fullscreen it works like a charm. The problem is though when I run it in fullscreen it freezes a frame before the movie.

Here's the error I get when debugging: ReferenceError: Error #1056: Cannot create property ryt on flash.display.Stage.

From what I googled I understood that this was caused because somehow the movie clip is set to private, and flash can not access it.

The solution is to declare this movie clip public.

That's where my AS3 knowledge ends, I tried "public var ryt;" but then it says I have to declare this in some package.

View 4 Replies

ActionScript 3.0 :: Access Public Static Var?

Jun 16, 2011

So my question is how i can access public static var from an external loaded swf?

View 9 Replies

ActionScript 2.0 :: Make A Public Variable?

Jan 23, 2012

I om trying to make one class with:[code]...

but i cant acess the var from class 1 with class 2. how could i make it a public var? ive tryed:

public var velocity;

and

var velocity:string;

make the var accessable for all classes?

View 0 Replies

ActionScript 3.0 :: Pass Value To Public Variable?

Apr 29, 2009

finally have a working hitTest (YAY!!!!), now, my code is setup to create 3 'sasquatches', the problem is for the hitTest to work, the variable "one" has to be public. Now, in the next bit of code we create 3 instances of one using a for loop, BUT they all three are in the same spot cause I can't figure out how to pass Random numbers to the variable each time it creates.

Code:
package{
import flash.display.*;
import flash.events.*;

[code]....

View 2 Replies

ActionScript 3.0 :: Cannot Access Public Variable

Nov 28, 2009

I think I've made some fundamental error here... I have a public variable a in class A, and I want to access it in class B, but I cant (access of possibly undefined property...) now every time I want to refer to a variable in class A I need to pass the variable reference to class B's constructor

View 4 Replies

ActionScript 3.0 :: Creating Public API For Player?

Aug 18, 2010

Is there any best practices one should follow when creating a public API for an existing application?

My my case it's a video player. We've built it to be *very* generalized and flexible so that it can be used by us, but also be licensed to third-parties.

I'm working on a new feature now where content on the page (relating to the current video) gets refreshed via a jQuery AJAX call when a new video in the playlist is cued, so I'll be having the player make an ExternalInterface call to a javascript function in the page in order to let it know when and what to update.

The problem is, how do I generalize such a thing? There are many cases where we *won't* need this functionality, and our clients will likely never need such a thing, either.

View 3 Replies

ActionScript 3.0 :: Public Vars With Bracket Sintax?

Aug 2, 2009

I would like to create a collection of movieclips in the main timeline, but would like to declare them in a loop instead one by one, something like this:

Code:
for (var zz=1;zz<=10;zz++)
var ["mc"+zz]:MovieClip = new MovieClip();
Instead:[code].....

I know that my sample doesnt work,

View 3 Replies

ActionScript 3.0 :: Access Of External SWF's Public Methods

Apr 23, 2009

How would I access a loaded in swf files public methods in my main swf. 
 
var temp:ExternalSWFLoader = new ExternalSWFLoader("FX_Ticker.swf");
temp.x=temp.y=0;
Ticker =(Sprite)(temp);

[Code]......

View 18 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved