Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Global Arrays?


I am fairly new to actionscript and I am having trouble finding info on how to set up a global array . In actionscript 2 it is:

_global NameOfVariable = new Array (1,2,3,4,5);

..but in Actionscript 3 it does not work?

My goal in the global array is to have an XML database loaded in and accesible throughout my script.




ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 11-04-2007, 08:01 PM


View Complete Forum Thread with Replies

Sponsored Links:

Global Arrays?
I was reading through the help files (flash 8) and it says that arrays are automatically set to global. Ok, that's cool and all, but when I try to access an array inside a movieclip, without the _parent method, I get undefined when I trace it. I have since figured out the problem with my scope, however, according to the help files, they should be global...and global is global is global.

Anybody know what's up with this?

View Replies !    View Related
Global Arrays In LoadVars Undefined
Heellp... I have read all the threads I could find on this topic, but now I've gotta give up.

The question is simple, but the answer isn't... or so it seems.

How can I make the arrays, defined in mycode accessible outside the loadVars object??? The arrays stays local no matter what I do. When I access data in the arrays inside the loadVars object it works okay, but ouside they are "undefined"....!

I have tried using the _global property in every thinkable way, but it does not work.... and now I am completely lost!

What I am trying to do is to build up a poll, importing data from a mysql database. The data import goes fine, and the comboboxes and dynamic text fields in Flash are filled with the data from the database, but, I need the arrays for calculating percantages and totals for when the user clicks submit,

Check out my work in progress here (it's in Danish):
http://www.andand.dk/ulydige_db/ulydige_poll.swf


Here's the code:

var var_loader = new LoadVars();
var var_saver = new LoadVars();

var_loader.onLoad = function(success){
if (success){
var headline_array:Array = this.headline.split("~");
var sp1_array:Array = this.sp1.split("~");
var sp2_array:Array = this.sp2.split("~");
var sp3_array:Array = this.sp3.split("~");
var sp4_array:Array = this.sp4.split("~");
var sp5_array:Array = this.sp5.split("~");
var sp6_array:Array = this.sp6.split("~");
var sp7_array:Array = this.sp7.split("~");

var sv1_array:Array = this.sv1.split("~");
var sv2_array:Array = this.sv2.split("~");
var sv3_array:Array = this.sv3.split("~");
var sv4_array:Array = this.sv4.split("~");
var sv5_array:Array = this.sv5.split("~");
var sv6_array:Array = this.sv6.split("~");
var sv7_array:Array = this.sv7.split("~");

spørgsmål.sp1.text = headline_array[0];
spørgsmål.sv1_1.label = sp1_array[0];
spørgsmål.sv1_2.label = sp1_array[1];

spørgsmål.sp2.text = headline_array[1];
spørgsmål.sv2.dataProvider = sp2_array;

spørgsmål.sp3.text = headline_array[2];
spørgsmål.sv3.dataProvider = sp3_array;

spørgsmål.sp4.text = headline_array[3];
spørgsmål.sv4.dataProvider = sp4_array;

spørgsmål.sp5.text = headline_array[4];
spørgsmål.sv5.dataProvider = sp5_array;

spørgsmål.sp6.text = headline_array[5];
spørgsmål.sv6.dataProvider = sp6_array;

spørgsmål.sp7.text = headline_array[6];
spørgsmål.sv7.dataProvider = sp7_array;
spørgsmål._visible = true;}
else {
_parent.tekst.text = "data could not be read...";}}
var_loader.load("ulydige_poll.php");}

View Replies !    View Related
[CS3] Global Function = Global Variables As Well?
CS3/AS2
if i have a global function with some variables defined within it, are the variables global too? if not how would i make them global too?

_global.function someFunction() {
var cake = 10;
var book = 15;
}

someFunction is global so therefore "cake" and "book" are too?

View Replies !    View Related
Global Function, Global Variable
how to declare global function and global variable? if i declare it just in frame 1, then the object in other frame can reach it? thanks for answer..

View Replies !    View Related
Arrays In A Text File To Arrays In Flash
What i am wanting to do is get an array list from an external file and put it into flash arrays, the code i tryed to use was this:


PHP Code:



            for (i=1; i<33; i++) {
                
                if(id=="undefined" || id=="NaN"){
                    
                } else {
            
                id[i] = id(i)

                               }

                         } 




But that dosent work obviously.

I know ive got the
PHP Code:



id[i] 




bit right, but i dont know how to do the bit from the text file.

in the file it goes like this:


PHP Code:



id1=432&id2=324 ect 




So basically what i am trying to ask is how to in a look do variables using the i (id plus the i at the end). Anyone got any ideas?

View Replies !    View Related
Are Global Variables Really Global?
Hi everyone!

This might sound like a dumb question, but i've just been struggling with variables (more specifically global variables) for the last 3 hours, and now that i made it work, i'm wondering if my solution is the "normal" one.

From what i gather, when you declare a _global variable, you can just use it from any timeline without using a path, right? I have a variable (whichHoliday) which i initiate in the first frame of the main timeline, this way:
_global.whichHoliday="";

I want to give a new value to this variable inside a MC on that timeline. The only way i could do it was by using:
_global.whichHoliday="whatevervalue";

Shouldn't i have been able to use only: whichHoliday="whatevervalue" ?

Why did i need to use _global again to set the value?

Thanks for any input!

View Replies !    View Related
[F8] My Global Variables Are Not Global
Hi
I have a problem, my global variables aren't global, as soon as a new timeline is entered the global variable is undefined. (I read somewhere in a forum that it is only possible to use a couple of global variables for F8, could that be correct?)

I use:

if (_global.thing == true){
thing._visible = true;
}

This works for the timeline where true was set and one more timeline, but as soon a third timeline is entered the global value is set to undefined!

What could be the problem?

I am soo grateful for any suggestions!

Thanks!

View Replies !    View Related
My Global Variables Don't Seem So Global
what the hell am i doing wrong!?

heres what i've got:


in my UI class i have this:
#include "ContainerClass.as"
#include "MapClass.as"
#include "ObjectiveClass.as"
#include "SponsorClass.as"
#include "MeasureClass.as"
#include "InitiativeClass.as"
#include "AnalystClass.as"
#include "MilestoneClass.as"
#include "StoryLineClass.as"
#include "CommentsClass.as"
var dbPath = "localhost";
_global.scriptPath = "http://"+dbPath+"/strategymap/scripts/";


then in all of the included files i have something like:

myloadvars.sendandload(scriptPath+"/filestoload.whatever",x,"POST");;



sometimes i just want to break something. grrrrr!

View Replies !    View Related
Sorting Arrays...2-Dimensional Arrays
How would I go about sorting two dimensional arrays using the sort() function. What I'd like to do is organize the arrays inside of an array by a certain variable...

i.e:

array1 = new Array("Name", "State1", "Cost");
array2 = new Array("OtherName", "AnotherState", "OtherCost");
array3 = new Array("DifferentName", "YetAnother", "AndAnother");
allarrays = new Array(array1, array2, array3);

Now, let's say I want to sort the arrays in allarrays by their state variable. In other words, I want to sort them so allarrays would look something like this (if sorted by state):

allarrays:
array2,
array1,
array3

Any suggestions or past experiences with this sort of sorting? Would I use the Sort() fuction? or would I have to make my own sort function? Thanks in advance for any help you can provide.

View Replies !    View Related
Arrays: Cleaning Up Empty Arrays
Hi,
So, I have an array generator, and its not worth explaining the details, but long story short, I end up with an array in which some of the slots are "undefined". How can I go through and remove just those slots? Eg this this my Array

myArray[1] = "red"
myArray[2] = "blue"
myArray[3] = undefined
myArray[4] = "pink"
myArray[5] = "undefined

and what I want to end up with is:

myArray[1] = "red"
myArray[2] = "blue"
myArray[3] = "pink"

thx!

-Z

View Replies !    View Related
Arrays/Arrays/Arrays/and Functioning.
Can someone please , tell me how to shorten that Rescale function to just do all the movies in one shot ? and also to add an array for the delay which is the ( o.2, 0.4,0.6 ) so i need to shorten all this to do something like this


Code:
rescale = function(){
this.scaleTo(100,2,"easeOutElastic",this.speed);
this.alphaTo(100,2,"linear",this.speed);
}
//... the next line is inserted within the duplicate movie loop
eval("item"+a).speed = 0.2*a


Instead of all this..

Code:
// Callback Function for lacos to tell when to rescale/alpha back to 100 percent
reScale = function(){
//How can I shorten this by just making an array and doing this in One shot ? is the only problem
item0.scaleTo(100,2,"easeoutElastic",0.2);
item0.alphaTo(100,2,"linear",0.2);
item1.scaleTo(100,2,"easeoutElastic",0.4);
item1.alphaTo(100,2,"linear",0.4);
item2.scaleTo(100,2,"easeoutElastic",0.6);
item2.alphaTo(100,2,"linear",0.6);
item3.scaleTo(100,2,"easeoutElastic",0.8);
item3.alphaTo(100,2,"linear",0.8);
item4.scaleTo(100,2,"easeoutElastic",1);
item4.alphaTo(100,2,"linear",1);
item5.scaleTo(100,2,"easeoutElastic",1.2);
item5.alphaTo(100,2,"linear",1.2);
item6.scaleTo(100,2,"easeoutElastic",1.4);
item6.alphaTo(100,2,"linear",1.4);
item7.scaleTo(100,2,"easeoutElastic",1.6);
item7.alphaTo(100,2,"linear",1.6);
item8.scaleTo(100,2,"easeoutElastic",1.8);
item8.alphaTo(100,2,"linear",1.8);
item9.scaleTo(100,2,"easeoutElastic",2);
item9.alphaTo(100,2,"linear",2);
item10.scaleTo(100,2,"easeoutElastic",2.2);
item10.alphaTo(100,2,"linear",2.2);
item11.scaleTo(100,2,"easeoutElastic",2.4);
item11.alphaTo(100,2,"linear",2.4);
item12.scaleTo(100,2,"easeoutElastic",2.6);
item12.alphaTo(100,2,"linear",2.6);

};

//Duplicate method puts all movieclips on stage at 0 alpha so the user doesnt see the placement
for (a=0; a<titles.length; a++) {
duplicateMovieClip("item", "item"+a, a+1);
//eval("item"+a).alphaTo(0,0,null);
eval("item"+a).item_txt.text = titles[a];
eval("item"+a).tween("_x", [posX[a]], 4, "easeoutElastic");
eval("item"+a).tween("_y", [posY[a]], 4, "easeoutElastic", 0.1);
//Callback function is set here
eval("item"+a).scaleTo(0,0.2,"easeoutElastic",0.1,reScale);
item._visible = false;
}

View Replies !    View Related
Arrays Referencing Other Arrays?
Picture this... I declare two arrays:

array1= new Array();
array2 = new Array();

Then I went through some data and added values to "array1". For this example, let's say it has 20 values. (length = 20)

I want array2 to be a "backup" of this data, so I did this:

array2 = array1;

I would expect array2 to simply be a copy of the contents of array1. But, whenever I .pop() a value off of array1, array2 ALSO loses that same value! How is this possible? Is array2 only a "reference" to array1??

View Replies !    View Related
Only Arrays Or Arrays And Objects
Hi

I've been told not to do this with an array...


PHP Code:



var travelbooks:Array = new Array();
travelbooks.push({titel: "Madrid", release: 2004, pages: 248});
travelbooks.push({titel: "Barcelona", release: 2003, pages: 224});
travelbooks.push({titel: "Tenerife", release: 2002, pages: 124});
travelbooks.push({titel: "Malaga", release: 2005, pages: 172});

for (var i=0; i < travelbooks.length; i++) {
     trace(travelbooks[i].release + " - " + travelbooks[i].titel);





... but to do this...


PHP Code:



var travelbooks:Array = new Array();

var book_1:Object = {titel: "Madrid", release: 2004, pages: 248};
var book_2:Object = {titel: "Barcelona", release: 2003, pages: 224};
var book_3:Object = {titel: "Tenerife", release: 2002, pages: 124};
var book_4:Object = {titel: "Malaga", release: 2005, pages: 172};

travelbooks.push(book_1, book_2, book_3, book_4);
trace(book_1.titel);
trace(travelbooks);
trace(book_releases);

function book_releases():void {
    for (var i:Number = 0; i < travelbooks.length; i++) {
        trace(travelbooks[i].release + " - " + travelbooks[i].titel);
    }





Could you tell me why i'm not supposed to use the first example? And why example 2 doesn't work?

Thank you
Ferran

View Replies !    View Related
Creating Arrays From Arrays?
I'm not sure this is possible but...

I'm trying to create a series of arrays from one main array.

My main array [main_elements] contains four items - interactive, motion, print and illustration. This main_elements array is dynamically created from an xml file.

I'm wanting to create a set of arrays based on the content within this initial 'main_elements' array.

So i would end up with an interactive array, motion array , print array and an illustration array.

currently i'm at this stage with it...although i've tried every other combination i can think of to get it working.


ActionScript Code:
for(q=0; q<work_elements; q++){
 
    main_elements[q] = xmlDoc_xml.firstChild.childNodes[1].childNodes[q].nodeName
    //this is the actual categories of work - the areas - interactive,motion,print,illustration
   
    var Vname = work_elements_ARRAY[q]
    //i need to create an array based on the names in the work elements area
    //ie i need an interactive array - motion array etc
    Vname = new Array
                   
    trace("Vname-- "+interactive.length)
    //this trace should pick up the newly created interactive array but it doesn't exsits...???
    }//end of second for
 


I would then fill these arrays with the work items.

As you can guess its a menu system of the simplest kind i'm trying to build.

Is there a better way to be doing this or is it a case of correct syntax / approach??

View Replies !    View Related
# Of Arrays - Length Of Arrays
Is a length of 540 to long for an array?
If so what a good limit to cap it at?

What # arrays of max limit are to many for a flash movie?
10?
100?
1000?

I'm just curious as i need to track the _x and _y of a dragable MC for as long as possible - 3 to 4 minutes if i can squeeze that. It needs to have smooth motion when it's played back, so the cord's need to be stored about 3 times a second. I was just wondering if anybody has an idea of how much data is too much?


All comments are welcome. Thx

View Replies !    View Related
Arrays In Arrays Trouble
does AS3 have capability to do multidimensional arrays? My computer won't let me download it because I have edu version. 2D arrays would make this a lot easier. Here's the class:

Code:

class com.samainsworth.math.matrix {
   
   var arr:Array;
   var r:Number;
   var c:Number;
   
   public function matrix(r:Number, c:Number) {
      this.arr = new Array(c);
      for(var i in this.arr) {
         this.arr[i] = new Array(r);
      }
      
      this.r = r;
      this.c = c;
   }
   
   public function getPos(r:Number, c:Number) {
      return this.arr[c][r];
   }
   
   public function fillPos(val, r:Number, c:Number):Boolean {
      if(r <= this.r && c <= this.c) {
         this.arr[c][r] = val;
         return true;
      }
      else {
         return false;
      }
   }
}

here's the code in the movie:

Code:

import com.samainsworth.math.matrix;

var m:matrix = new matrix(2, 2);

trace(m.fillPos(1, 0, 0));
m.arr[0][0] = 1;

trace(m.getPos(0, 0));

and last but not least here's error:

Code:

true
undefined


I'm trying to work on 3D which requires a lot of matrices work even though flash doesn't support 3D you can fake it with a lot of math - http://www.kirupa.com/developer/actions ... onCube.swf

View Replies !    View Related
Global
Can I use Global variable in action script ?
thanks
Guillaume frechette

View Replies !    View Related
Global?
Hi!

Just read an article on actionscript coding standards and came across this: what is _global exactly, and also, when to use _global, _root or this. Really confused about which should be used and when =P

Another question is about playing midi files. Is there a way to sort of use quicktime plug-in to play a midi file in sync with a flash movie, and to control the plug-in from within the movie, i.e., change the music file when a scene changes?

Thanks ^_^

Russ.

View Replies !    View Related
Global
O.K. I need help plez! I am trying to make a game but i need help. I need a variable that can be used in main timeline and movie clips, so... I put a _global. in front of the variable def.
_global.score = 0;
.....but now, my dynamic text reads
"level0.score"
I checked everywhere, but still have no clue how to fix this, please help!

Thanx

View Replies !    View Related
Global
O.K. I need help plez! I am trying to make a game but i need help. I need a variable that can be used in main timeline and movie clips, so... I put a _global. in front of the variable def.
_global.score = 0;
.....but now, my dynamic text reads
"level0.score"
I checked everywhere, but still have no clue how to fix this, please help!

Thanx

View Replies !    View Related
Global
Is there an official place to put global variables and functions; I usually put this stuff in 1st keyframe actionscript.

View Replies !    View Related
[CS3] Global Var?
I have the following button that sets the var itemType:

button.onRelease = function():Void {
itemType = "yes";

}


But when I set the itemType using the button I want it to be used outside of the function, how can I get it to intiate a piece of code and use the itemType set by the button?

View Replies !    View Related
Global MC?
Is there such a thing? Because I'm loading an external .swf into a movie clip and the flash progresses onto the next scene, I was hoping that I could keep the frame at the same position as before the scene change.

Is this confusing or do I have to pass the _currentframe properties to a variable and tell it on frame 1 of the next scene to go to that frame again, causing a break in the flow of that mc?

Any idea's?

View Replies !    View Related
Global Var
Can a var be set as global for use by all functions in a single fla file?

I would like to set a var in any one of 3 functions (dependant upon user choice) and then be able to read it's value in a fourth and fifth function.

something like this:

//----------------------------------------------------------------------------------------------
public var choice1

function onechoice() {
//do something
//set choice1 value
choice1 = "one"
allchoice()
}

function twochoice() {
//do something
//set choice1 value
choice1 = "two"
allchoice()
}

function threechoice() {
//do something
//set choice1 value
choice1 = "three"
allchoice()
}

function allchoice() {
if (choice1 !=undefined){
checkchoice()
}

function checkchoice() {
//do something
//set choice1 value
switch (choice1) {
case "one" :
//do this
case "two" :
//do this
case "three" :
//do this

}
//end checkchoice
}
//--------------------------------------------------------------------------------------------------------------




Is this possible?

View Replies !    View Related
Global CSS
hello,
i have something like "3-level" depth project of .swf movies loading into the main .swf.
i have one CSS style in root of the main .swf

----------------------------------------
var flashCSS:TextField.StyleSheet = new TextField.StyleSheet();
_global.flashCSS.setStyle("p",
{color:'#000000',
fontFamily:'Verdana, Geneva, Arial, Helvetica, sans-serif',
fontWeight:'normal',
fontSize:'10'}
);
_global.flashCSS.setStyle(".hdl",
{color:'#959595',
fontFamily:'Verdana, Geneva, Arial, Helvetica, sans-serif',
fontWeight:'normal',
fontSize:'10'}
);
...
----------------------------------------

i would like to apply this CSS to ANY textfield in ALL levels of the project ...
but if i apply the CSS in some loaded (external) .swf like this:

----------------------------------------
textWindow.styleSheet = flashCSS;
textWindow.htmlText = "<span class='hdl'>Example Example Example</span>";
----------------------------------------

it does not work at all and CSS is not applied

does anyone know how to use one CSS globally in all levels of the project (including loaded external .swf)?

View Replies !    View Related
Global Value...
Hello all..
I need a help for my current project.....
actually i have nearly 5 swf's in different levels.
i need to use all these swf's and some common variables or values...
as there is no option for variable passing b/w levels i'm not able to do that...
is there any alternatives to access the variable (i need to update or change the values of varables).

can anybody suggest a solution...
solutions will be highly appreciated...thanks in advance...

View Replies !    View Related
I Need A Global Var?
Hello again, i have this code.


PHP Code:



import flash.display.*;import flash.events.*;import flash.utils.*;import flash.display.Loader;import flash.display.MovieClip;import flash.display.LoaderInfo;import flash.net.URLRequest;import flash.text.TextField;import flash.events.Event;import flash.events.ProgressEvent;import caurina.transitions.Tweener;import flash.display.MovieClip;import flash.display.StageAlign;import flash.display.StageScaleMode;stage.align=StageAlign.TOP_LEFT;stage.scaleMode=StageScaleMode.NO_SCALE;stage.addEventListener(Event.RESIZE, resizeHandler);addEventListener(Event.ENTER_FRAME, resizeHandler);var aCarregar:Loader = new Loader();carregarSwf("count");function resizeHandler(event:Event):void {  preloaderBarra.x = (stage.stageWidth/2); preloaderBase.x = (stage.stageWidth/2); preloaderLogo.x = (stage.stageWidth/2); menuTopo.x = (stage.stageWidth)/2; footerTexto.x = (stage.stageWidth)/2; footer.width=(stage.stageWidth); footer.align=StageAlign.LEFT; var externalMovie = MovieClip (aCarregar.content); trace("externalMovie "+externalMovie); if (externalMovie!=null){  trace("nao ha")  }  else{   externalMovie.centro.x=(stage.stageWidth/2);   }}function carregarSwf(teste:String) { var swfACarregar:String=teste; var swfQueCarrega:URLRequest = new URLRequest(swfACarregar+".swf"); preloaderBarra.alpha=0; preloaderBase.alpha=0; preloaderLogo.alpha=0; menuTopo.y=menuTopo.y-70; aCarregar.load(swfQueCarrega); aCarregar.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader); aCarregar.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);  }function showPreloader(evt:Event):void { Tweener.addTween(preloaderLogo, {alpha:1, time:0.5, transition:"easeOutBounce"}); }function showProgress(evt:ProgressEvent):void { var numero:uint = (evt.bytesLoaded/evt.bytesTotal)*100; preloaderBarra.width = (numero*1.55);}function showLoadResult(evt:Event):void { preloaderLogo.visible=false; preloaderBase.visible=false; preloaderBarra.visible=false; var externalMovie = MovieClip (aCarregar.content); stage.addChildAt(externalMovie,0); } 





How can i resize the extenalMovie, i cant call function resizeHandler with externalMovie inside, can someone help me?

Sorry de bad english

View Replies !    View Related
Global Variables Within MCs
ive used this code on a button:

selectedscene = "begincontactus";

and at the endd of the current scene ive said:


gotoAndPlay(selectedscene);

this works fine when the button is on the main timeline but when i put it wihtin an mc on the main timeline it doesnt work. do i have to use targets for gloabl variables? how?

View Replies !    View Related
Global Variables
ive used this code on a button:

selectedscene = "begincontactus";

and at the endd of the current scene ive said:


gotoAndPlay(selectedscene);

this works fine when the button is on the main timeline but when i put it wihtin an mc on the main timeline it doesnt work. do i have to use targets for gloabl variables? how?

View Replies !    View Related
Local To Global Example For D/l
I made a quick example for n8w over at Were-Here, who was asking about this. I know it's pretty straight forward, but if it helps anyone, you are welcome to d/l it. It's in the downloads section (duh) at:

http://www.developette.com

hope it helps someone...

View Replies !    View Related
Global Variables
ive used this code on a button:

selectedscene = "begincontactus";

and at the endd of the current scene ive said:


gotoAndPlay(selectedscene);

this works fine when the button is on the main timeline but when i put it wihtin an mc on the main timeline it doesnt work. do i have to use targets for gloabl variables? how?

View Replies !    View Related
Global Variables
ive used this code on a button:

_root.selectedscene = "begincontactus";

and at the end of the current scene ive said:

gotoAndPlay(_root.selectedscene);

this works fine when the button is on the main timeline but when i put it witin an mc on the main timeline it doesnt work. do i have to use targets for gloabl variables? how?

actually i have five MCs wtihin an MC on the main timline.
there is a button within each of the five MCs. an action on the buttons changes the variable. so ive created the variable first in the main timeline and refered to it from within the buttons' actionscripts. so i created

_root.selectedscene = "empty"

on the first frame of the movie just to create it.

why isnt it working??????????

View Replies !    View Related
Global Variable
how do i set a global variable??>??

i've been stuck with var statment...than after hours i found out that var is a local... variable

than i try set variable statment... and when i trace it... i can't get the variable...

acturally..
//i set a variable call interval
onClipEvent(load)[
interval = 20;
]

than inside that clip when i trace interval i get 20...
but inside the block

tellTarget ("_root.menu.web") {
trace (interval);
}
i get nothing...


[Edited by remote on 07-17-2001 at 09:00 PM]

View Replies !    View Related
Local And Global
hi...

can someone explain me the diff. between a normal variable & a variable created by var

i mean:
a = "name"
var a = "name"

i understand that its a local variable but wats the scope... the guide says its lasts in curly brackets only...

but can we use them across the frames...? on one timeline... or what...?

slightly confusing... i only use var for variables in loop like For (var i=0; i<=10; i++)

thanks
arpit

View Replies !    View Related
Global Variables
hi there,

how can i properly define global variables, meaning variables which can be seen from any scene in my movie?

if i start defining it (like normal) with "var myVar = 42" i can access it only from within this scene. if i just use it without defining it, i can access it from any other scene too, but it doesn't look very clean to me, so is there a better solution for this problem?

bye, stevie.

View Replies !    View Related
Global Varibles
how can i declare global varibles, used in the same movie but by different sequences? thanks, claudia

View Replies !    View Related
Global Var Declaration
I am trying to have variables accessable globally

I have declared then on frame 1 like this

hello = 450;

by using trace I can see that hello retains its value in frame two. so far so good

I wish to access my variable hello from within a button.
THe variable does not seem to parse here.

I place trace after an onrelase event and the variable comes up as empty and not 450.
I need to use this variable within my button script

What can I do? thanks in advance

View Replies !    View Related
Which Vars Are Global?
I have a movie in _root which has the ability to load a form that is contained in its own movie into _level1.

When this form sends the data to the server, it's sending a **LOT of information along with it. Some of this is good, some is a waste of bandwidth.

How do I know which variables will be submitted? I understand that global variables will go, does this mean all variables defined in _root, or will variables defined in _level1 go too?

Is there a common practice on where to store your variables so that they are not arbitrarily sent to the server? If so, how can I selectively send my vars to the server?

I thought that maybe I could load a different movie into _level1, and put variables there. Then load my form into _level2. Will this help?

Thanks,
Matt

View Replies !    View Related
Global Variables?
Simple, easy question that I can't seem to find the answer to: How do you declare and change a global variable? Thanks

-Llama

View Replies !    View Related
Global Varibles
Does anyone know if there is any way to set a global variable from within a function?

Here's a link to the page that I'm having a problem with: http://www.kawaguchi.ca/georev/main.html
Basically, what I need is a way to retain which primary section is rolled over. If anyone has any idea, I'd love to hear them.

Thanks in advance.

View Replies !    View Related
Variable In MC As A Global
Hi again,
here is another problem:
in my MC's (embeded a button) I am working with various variables which need to interact with one another, say if one variable is 2 another MC cannot be used anymore..:
on (release) {
door = door+1;
if (door == 1) {
setProperty ("/door-movie", _x, 327);
counter == counter+1;
trace(counter);
}
if (door == 2) {
door = 0;
counter = counter-1;
setProperty ("/door-movie", _x, -100);
}
if (counter>2) {
setProperty ("/door-movie", _x, -100);
door = 0;
counter = 2;
}
}
but my counter-variable is not traced.... what can I do???
(did you understand what I mean????)

View Replies !    View Related
Global Variables
I'm trying to do an Audio ONOFF button for my scene. This is what I did:
-Created a movie instance containing the wav file.
-Assigned the above instance to an object with "new Sound" command in first timeline frame:

suono = new Sound(audio); *audio IS THE WAV INSTANCE*
aa=true; *this global variable is intended to be used for the switch behaviour*

-Created a second key frame on time line and placed "Stop()" command.
-Created a switch button.
-Assignet the following script to the button instance:

on (release) {
aa=!aa;
if (aa==false) {
suono.stop();
}
else {suono.start()};

}


When first I press the button, the music stops, but after that I cant let it start again. The global variable "aa" works at the beginning, but seems that it cant keep the "false" value after the mouse leaves the button. This is what I think. Maybe the debugger would give great help in this matter, but I cant see the "aa" variable on it.
Any idea?

View Replies !    View Related
Global Variables
Hi,
I have two issues.I would greatly appreciate if someone can help. First thing, How do I create global variables like. I have created some variables by loading a xml file while loading the movie. I want to reuse them in the movie clip mousedown events. Now I am again loading it unnecessarily.
Secondly how do I reuse the functions I created in one movie in another. Now I am needlessly typing the same function in all the MCs.

Please help

Thanks
-r-

View Replies !    View Related
Global Data Or Not?
If I have a loadvariable on the 1st frame on the 1st scene, will all the variable imported still be kept in all subsequent scenes?

Thanks

View Replies !    View Related
Set Global Variable
hello...

i need to set a global variable from within a movie clip.

what i want to happen is when this particular movie clip plays, it sets this variable. i want the variable to be available the entire time (and throughout the movie), the clip is active on the stage. i then want to be able to reference this variable from anywhere else in the movie. can someone show me the way?

thanks...

View Replies !    View Related
Global Variabels
I have built my self into a corner. Is there some way for me to keep a variabels value alive when the movie starts over or to pass its value to the movies startframe.

View Replies !    View Related
Global Variable?
hi, here my problem:

i want to show a text-file in my swf, so i set the variable which contains the text.

in the main-scene it works, but in movie-clips, the variable is no longer set.

how can i set a variable global, or how can i put the variable from the main-scene in a movieclip?

sorry for my english

View Replies !    View Related
Global Variables?
Are there any way of making global variables in Flash 5??
I want to set some variables and access them in a couple of different scenes.

/Micke

View Replies !    View Related
Global Variables
Hi

How can i set a global variable at the beginning of a flash movie, so that the values are available to all other frames and MCs within it?

I tried using set variable commands in the first frame, but found that subsequent frames did not retain those values.

Your help appreciated.

BoB.

View Replies !    View Related
Global Variables
Maybe this is too much of a VB concept but can I create a Global Variable in flash. By that I mean one that will be recognized in all of the movie clips with out using _root???

Any help would be greatly appricated.

View Replies !    View Related
Global Variable HELP
I am trying to use the "if , else" function to get a page to play an audio only once -- just the first time a user opens the page, which is inside loaded inside another movie (a navigation system).

I've looked at trying to set a global variable after the audio is played for the first time which would communicate that it has been played to the script the next time this page opens.

I just can't figure it out.

I hope I have explained clearly enough.

Thanks!!!
-Rob

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved