ActionScript 3.0 :: Where Static Properties Exactly Available
Dec 19, 2009If I define same vars as static properties there are available where exactly?
View 3 RepliesIf I define same vars as static properties there are available where exactly?
View 3 Replieshow 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;
}
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 ??
View 3 RepliesI 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;}
}
}
ActionScript Code:
//such is a simply version of the hierachy of my project
// in DrawingTool.as[code]........
it's settled, why? must I give the explicit and full referrence to access the static property.
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 RepliesWhy static method cant access private properties in the same class?
View 1 RepliesLet's say you have the following situation:
1. Static var(an Array) stored in a class.
2. You create a variable reference to the static class in a separate class.
3. Splice some items from the reference variable in the separate class.
4. Trace the static class and the items have been removed from that too.
5. Verify several times.
6. Get confused.
7. Post on Kirupa.
Ok, so I have a bit of a mess here (Which I'm probably not doing right anyway, which could be my problem...). I have a document class, I'll call it as Body.as, that creates an object from another class known as Headgear.as. There are also other objects created from other classes, or will be in the future. Now, amoung all this, Headgear.as and all of the other classes Body.as will use to make objects require the use of dragging functions (starting and stopping dragging). On stopping drags, position checks are then made to compare a particular hidden movieclip with the dragged MC.
To try and save myself some hassle (from making the same functions over and over to ensuring that when the objects are created I don't need to send a complete crapload of variables just to ensure the position checking function would work), I had the functions for the event listeners (Which are set-up on the draggable MCs in Headgear.as) just direct to functions in Body.as
[Code]...
Yesterday I found myself wondering, what is the difference between either having a class with methods that are all static, or simply giving your class the static attribute?
View 9 RepliesAlright, so I have a class that is linked (via the linkage panel) to a scrollbox class. I'll paste the class here:[code]Ignoring the formatting, the commented out functions are the ones causing the issue. Adobe says that it's a static class and I can't use non-static functions. The way I wanted to use it was:
1. Call the page button generating function above.
2. In the main code in my program is this line:scrollbox.setClickFunction(historyContent.generate Page);So when the buttons that are supposed to be generated are clicked, the scrollbox class can call the History pages generatePage function and pass it which page to show. (I did this because there was a lot of text and a limit on how much would display, so small chunks sounded logical).
3. In the onClick function (which I haven't finished yet because the rest wont work), when you click one of the buttons it calls the set function. Its that simple.
I'm kind off oblivious as to what I'm doing wrong here... I have two classes: - Alley - AlleyCat
[Code]...
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 RepliesI 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]
Basically, what I mean is I i have few layers of classes, that calls and change something on the 1st(root) class. In between the process I have to use static var and static function.But when I want to run a function which does not change any variables, for example:otoAndStop(someFrames), I need to make the function a static function too or else there would be error
Code:
1061: Call to a possibly undefined method checkStatus through a reference with static type Class.
[code]....
i'm attempting to cast an object's property as an actual property of another object. here's my object variable: var propObj:Object = {prop:"width", width:50}; now i want to assign the property of a sprite using that object's properties. var sp:Sprite = new Sprite(); sp.(propObj.prop as Sprite.property) = propObj.width; now, i'm not even going to try that because i know the compiler will explode all up in my face. but you should be able to see what i'm trying to do. why i'm trying to do it is because i'm reading in an XML file with an undetermined list of usable properties for specific objects. so instead of writing something like a huge switch statement to evaluate whether the XML file has a value for that specific property, i'm trying to assign properties dynamically based on what's available in the XML file. if what i'm trying to do is possible, what's the best way to do it?
View 1 RepliesI know it's possible i saw it on several websites does some one know how i can use a static text in preloader counting to 100%? For an example look at ILOVETECHNO.BE The preloader a heart use a static text i think it cannot be a dynamic text because the font is not a normal average one
View 1 RepliesWhat I need to is to alter the html flash generated to have a static background that fills the browser, doesn't tile or scale that my movie can load over. I have messed with all the publish settings and I am sure I am just making all the wrong choices.
View 1 RepliesI would like to use an image as a link to play an FLV and have the movie open and play.
View 5 RepliesI need to know if the static text field in flash I can put a name to reference in it.
View 4 RepliesI've been trying to change the color of some static text using Flash Pro 8, and I can't figure out why, when I publish the file, the text looks like it's outlined in white. Almost like the stroke is white but the fill is the color I'm looking for.
View 1 RepliesI know about static function.What is static class? What is the use of static class? how can i use static class.? Give me a static class example?
View 5 RepliesWhat is static variable. what is difference between static variable and public variable?
View 2 Repliesbut I don't understand how this site functions. The URL changes but header is static, and the music plays without interruption.
View 2 RepliesHow do you mix static and dynamic text in one sentence?I want to display This audio is ::totaltime:: minutes long.Where ::totaltime:: is a variable determined in the ActionScript 2 codeCan I do this in a text box on the stage or does it need to be done in ActionScript 2? (I'm not using AS3, even though I'm in CS3.)If it's in AS2, I'm not used to outputting text from there, so how do I specify that the text be embedded Helvetica, 12pt, black, and starting at x:0, y:65 ?
View 1 RepliesI converted a static text field to a mc then thirty frames later inserted a keyframe and droped the mc's alpha to zero.. then created a motion tween between the keyframes... yet for some reason the text isnt fading when I test the movie... it works fine in the flash authoring environment as you click through the frames but it doesnt in the test movie mode.. any suggestions? ( i broke the text apart down to shapes and it worked fine, but that of course will cause indexing problems for content with google so this really isnt an option)
View 1 RepliesHi there, i am hoping for some advice on structure/optimisation from some of you experts . I am working on a portfolio system that is modular, each module works in a self contained way and does not require the other modules to function, though they can be 'linked' by having them all reference the same PortfolioData() class.
im happy with how it is working, but i feel there could be a better way to share the datasource between all classes rather than duplicating it and storing a copy in each class.
[Code]...
load in .swf files instead of static jpegs
View 2 RepliesI have created a Flash Map that functions properly with a static XML file but when I try to load a dynamic XML generated my ColdFusion I get no results. The example can be found at: http:[url]...The one that does not work is at http:[url]....
This map should load the different states that are in the XML file but instead it does not load any of them. The two different XML files can be found at: http:[url]....and http:[url].....An interesting note: Firefox does not recognize the cfm file as a XML file but IE does. This may be based on the file extension.
The Action Script is exactly the same except that it references adifferent file. The Flash works when published for Flash Player 6 but when I try to publish for Player 8 even the
static XML does not work.
I'm working on a flash website that consists of 3 frames (1 = preloader, 2 = instances of symbols, 3 = the main page/view). I've gone through and optimized all my static bitmaps/movieClips and removed any symbol that I've exported for ActionScript from exporting in the first frame. Even after all these steps frame one is still the longest to load (797kb on a 32.6 kbps simulated download), only showing the preloader when the whole file is at 86% complete. Any further steps to take to get frame one's size down?
View 3 Replies