Saturday, September 1, 2007

Female Genatalia Tattoos

based on variables in AS3 Preloader

variables


Apparently there is nothing to write about ... and yet, because, what can I talk to, without changing any programming language would be useless.

to the good stuff.
Generally speaking, the variable is a solution in which, since its creation, you can store virtually what you want: references to objects, properties, clips, numbers, functions, text, but which above all can use. With the help of variables and functions you can do what you want .. if you know how to go about it.: P

In Flash MX versions starting variables was divided into:
-
nonlocal variables - local variables
- global variables (Available from MX)
Here a closer look at


nonlocal variables are variables created in the timeline of the MovieClip'a or inside another object. The values \u200b\u200bin these variables are always stored in memory until the clip is in the player, (that is, until it is deleted or does not end its presence in the parent timeline) or variable (or object) will not be removed using operator delete .
in ActionScript is not required to declare a nonlocal variable by using the var keyword. Such variables are created at the time of naming them, or give them the character of the variable
 variable = 100 
trace (variable) / / output 100

For such variables, we have access not only to strip the current clip, we can come to It also appealed from anywhere in the film,
  / / on _root, declare a variable nonlocal 
var v = "abc "
/ / somewhere in the timeline clip nested
var text _root = . v + "def "
/ / Or
var text = _parent . _parent . _parent . V + "def "
trace (text)
/ / output: abcdef


Despite the fact that variable declaration does not require the use of the word var, it does use it in my mind, improves readability of the code and appears to be a good idea.

nonlocal variables can be declared in an object from another (say it) MovieClip'a
  / / example 
_root. JakisMC.zmienna = " hohoho "
in this case are prohibited words var.

following syntax:
_root.jakisMC.zmienna var = "hohoho"
... will compile error.


Local variables are temporary variables, declared in the function body and used when performing this function. Upon completion of the function variables such are removed from and does not pollute the memory of the player. The declaration of such variables did not differ from non-local variable declarations, except that if the declaration does not add the var keyword , this variable will be created as and after the non-local features will still be available, or changes the value of existing non-local variable of that name.
 show =   function () {
var a = "I'm " / / local variable declaration
trace (" in the function body: " + a)}

show ()

trace ("after the function : " + a)

in the output window, see:
functions in the body: I \u200b\u200bam
after the function undefined


If you've got the declaration of variable "a" word var would see the output window:
functions in the body: I \u200b\u200bam
after the function: I

In this particular case remains such a variable does not do us harm, but what if the memory is to us array is used to calculate some "matrix" with the 1500 indices, each consisting of 5 digit number?

not use the word var can also lead to non-local variable overwriting. Example
   var a = 1, b = 2, c = 3  / / declaration of variables nonlocal 
function show () {var
a = 25, b = 50; / / declaration of local variables
c = a + b}

show ()
trace (c) / / output 175

variable c has been overwritten.
If I would not use the word var in the function body would also be overwritten and b variables.
may be added that, as you noticed, a considerable ease of use is the following way variable declarations
  / / eg .. 
var a = 1, b = [], c = new LoadVars ();



Global variables are accessible from anywhere in the aforementioned film. Declaring, recall and change the value of such a variable is as follows:
  / / declaration of a global variable named "variab" 
_global . Variab = " value;

/ / change anywhere in the film
_global . variab = " completely different value "

/ / call the variable from anywhere in the film, using its value
MyText = Variab;
/ / or if on this timeline is variable
/ / with the same name as global variable (see explanation below)
MyText = _global . Variab;

Here it should be mentioned that if the timeline is another variable called "variab" will be read first of its value, the compiler will search the global object in the search for such a variable.
  / / example: 
_global . Variab = 5
variab = 100
var result = variab + 5
trace (result)
/ / output window, we see 105 instead of the "expected" 10
/ / variable variab was found in the timeline of the current clip

The use of global variables, if you really have a good reason.

link variables.


Note that variables are related to each other by value not by reference. Quickly let's see one example
   var a = 5 
var b = a a = 10

trace (b) / / output 5

The value of b has not changed although the changed value of the variable a. This is an instance variable with the value of links. The compiler does not remember "then" inherited value of the variable. The variable b given the value of another variable of the moment and this value was stored.

Referring to the variables.


Remember that the variable can be successfully appealed, if it exists. Example:
   var added = x + x 
var x = 5
trace (added) / / output: undefined

To refer to a variable, you must first create it.


Types in ActionScript is not required to comply with the data types stored in the variables. If you declare a variable which stores the data string is at any time you can override this variable so that kept the data type Number, or any other.
  / / example var 

angle = 270 angle = " dwieściesiedemdziesiąt "

compiler will not spit in this case, no error. However
Flash MX2004 from the introduction of language and ActionScript2 can control the data type using the syntax
   var angle:   String = " dwieściesiedemdziesiąt " 
If we try to put in the variable data, other than a String, (eg .: angle = 270), the compiler does not allow such an operation.

So much for the subject variables. I hope this brightened reels you some things.
Pozdr.

0 comments:

Post a Comment