If I created a static method. say I decide to call on other methods within that static method. Do those methods I call on need to be static as well? what If I used some of the properties. Not to store data permanently, but just within that process. Do those properties need to be static ??
I am working on setting up some simple AI actions for my enemy class in the game that I am working on, but I am having trouble accessing the player's X location within the enemy package to set up a detection function. I have defined the player on my Level package along with the enemy, and I defined the player's and enemies X and Y locations within the Player/Enemies package respectively.
Within my flash file I have linked to my Level.as file. Also within my flash file library I have two movie clips. Both have a square in them that are the same size but colored differently. One is called PlayerSpriteMC and the other is called EnemiesSpriteMC.
I am using get/set functions to make variables that are (or appear to be) read only. I can get it to work with instance variables, but not static variables. I found this, which seems to indicate that it's possible to use get/set functions on static properties, but the compiler keeps telling me I have duplicate function declarations. This is essentially what I'm using:
package { public class Foo { protected static var bar:int = 0; public static function get bar():int {return bar;} } }
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.
I have an xml parser that i tried to code into an external class/package.I have no experience with packages so its been difficult but i got most of the way there.The code works, the problem is that i dont know how to access the output variable from the package in my fla file.How can i use the variable allText in my fla?
I inherited a project and this thing is a real Frankenstein. It is a combination of external classes, flex xmls and action script on timelines of objects in various swf files. I have a situation where I need to access a class in a package a few directories up. For example my direcoty structure is similar to the following:
I'm developing an AIR application, where i need to access WindowedApplication's function from the package class. This is the Main application (Partial code)
I have a package that extends my sound class that I want to also control the alpha of an existing symbol on my stage. I have read that this would be ideally done through some sort of event listener but I can't find a way to do it. Basically, my package generates a wavelength that I want to control the alpha of an existing library symbol. I have gotten examples to work the way I wish but can't seem to get my package to access the main .swf's library.
Here's the code:
package {import flash.events.SampleDataEvent; import flash.media.Sound; /** * A dynamically generated binaural beat carrier wave Sound with frequency easing. */
I am getting Syntax Error 1202 (Access of undefined property connection in package model) in the following code while trying to access the model.connection property. I don't see any reason why this would appear, can anyone see something I may be overlooking?
I have a movieclip in the library with the linkage name:BackgroundClip, so in the constructor I create it, add it to the display list and can even access and modify its properties, which I tested with the x position. Now what im having issues with is getting the stage resize listener to adjust the BackgroundClip instance, bg, to the stages width and height. In the clip is an image, so if someone has a better way of using classes to create full screen liquid gui im all ears![code]
I often write apps in flash where I wrap all the display elements into one parent display object container (not the stage). Let this parent container be mc_world for example. I declare this in my Document class (Main) as:
ActionScript Code: public static var mc_world:MovieClip;
Since this container is unique and often times needs to be referenced from various classes in the project (that are not its children) I find myself often doing Main.mc_world across my project to access this container.
Is it bad practice to directly access static members of the Document class throughout my project? Are there any simple alternatives? I don't want to dispatch events every time I need to access mc_world. And using a singleton class doesn't seem all that different from the Document Class (which only has one instance right?).
I have a set of classes that I've been using in one Flex program (Classroom). I just created new project and referenced the source path of the first program's com directory in its build path.
When I do an import, import com.cade.comm.CADEports;, everything looks good. When I use a variable in the code, CADEports.gotComm = true;, it still looks good. However, when I try to run it, I get an 1120 error that says "access of undefinded property...".
In the main program:
Flex Build Path -> Source path = ${DOCUMENTS}/Classroom/src/com import com.cade.comm.CADEports; ... CADEports.gotComm = true; // compile error here although when you type CADEports. it shows the gotComm variable!
[Code].....
Why does this work in the original program but not the second?
I'm literally new in AS3 and slowly trying to migrate in thats why im here seeking for help. Can someone help me how to access/control a certain public variable in a loaded swf from the main swf? this problem has been paralyzing me for days. (sigh...) [code]...
I load many classes in at runtime from external SWF's, accessing those classes is pretty simple, like so - var currentDomain:ApplicationDomain = ApplicationDomain.currentDomain; var modelClass:Class = currentDomain.getDefinition(className) as Class; var model:Model3D = new modelClass(); However I've never tried to access static functions from a runtime class, and now I need to. How is it done? It seems like something that should be simple, but I haven't worked it out yet.
I have a getter within a class which is used to make my property skin:DisplayObject read-only. This class also has a property body:AvBody which is used to define the x y width height etc of the object, which in turn positions the skin.
What I want to do is disable access to the properties x and y on skin unless accessed from within the internal namespace (where AvBody is also located) Is this possible?
Note: I can't make skin any type other than DisplayObject (I can't even make skin a class that extends DisplayObject because it creates issues with library symbols).
I have a calendar where each day is a movie clip called 'day'.I use calendar1 movie clip as a parent to day, which means day is inserted into calendar1 using this line..the issue is that I can't access any of the checkbox properties, but all of the text properties as illustrated below.[code]
I need access to the properties of a file I load on the next line. Specifically, trying to pull the _height and _width off of it.
I think it's being bungled up because it's inside a function running two (nested) for statements. Let me post up the code for you geniuses[code]...
The width traces fine in the onLoadInit, but only AFTER the function that is creating and positioning the movieclips is finished running. They are nested in something of a complicated heirarchy so to save the widths in another array and then try to move them all later would be bonkers.