_global Problem (between Two Movies)
Hi, (I 've read other _global topics & didnt help ) my second swf (which will display as a tip in windows) reads data from Access. Buttons are in the first swf. Onrollover sends an "id" to the second swf.
first swf says:
_global.num = 2; loadMovie("second.swf","golge");
second swf: movie_on_load: any_num = _global.num;
tip says: (which is a moveClip) loadVariables("GetDetail.asp?Record="add String(_root.any_num) ,this);
....
there is a BIG mistake for me ...
I couldnt find anything. What's wrong???
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 02-19-2004, 09:31 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
_global Problem (between Two Movies)
Hi, (I 've read other _global topics & didnt help )
my second swf (which will display as a tip in windows) reads data from Access. Buttons are in the first swf. Onrollover sends an "id" to the second swf.
first swf says:
_global.num = 2;
loadMovie("second.swf","golge");
second swf:
movie_on_load:
any_num = _global.num;
tip says: (which is a moveClip)
loadVariables("GetDetail.asp?Record="add String(_root.any_num) ,this);
....
there is a BIG mistake for me ...
I couldnt find anything. What's wrong???
_global Functions In Loaded Movies
Looking for some help here...
I have a main movie (lets call it "main.swf") which calls several modules ("module1.swf", "module2.swf", etc.) at the click of a button.
I am running into an error where the _global functions in my loaded movie (module1) do not run when a button is clicked within that movie. If I open up the SWF file for module1 and click the button, the _global functions work. Upon mouse (release) they're loaded with the following script from main.swf:
loadMovie("module1.swf",_root.mc_moduleholder);
Both SWF files are located in the same directory on the hard drive.
In "module1.swf", a button is clicked which does the following:
ImageClick(selectedImage);
On the main timeline in module1.swf I have a movieclip which contains all of my _global functions. The above function simply tells several movie clips on the main timeline in in module1 to do whatever... which they don't do when module1 is loaded into main.
A bit overkill in the description, I know. Sorry 'bout that. Thanks for any advice...
Convert _global Varibles To _global Array?
I'm having a problem with conflicting _global variables and was told that an array may solve my problem. I need to convert the code below to an array, but I'm a newbie when it comes to _global arrays.
How can I convert this?
Quote:
//ROLLOVER
/////////////////////////////////////////////
on (rollOver) { this.button2 = true; }
on (rollOut) { this.button2 = false; }
//SETS BUTTON OVER STATES
/////////////////////////////////////////////
on(press) {
for (var i in _global) delete _global[i];
_global.button2_on = true; }
// ROLLOVER FUNCTION (First Frame of MC)
/////////////////////////////////////////////////
this.onEnterFrame = function() {
if (button2) {
this.gotoAndStop(9);
_global.main_over = true;
} else {
this.prevFrame();
}
if (button2_on) {
this.gotoAndStop(9);
_global.main_on = true;
}
};
Here's an example of the menu: www.earph.com/test.html
Convert _global Variables To _global Array?
I'm having a problem with conflicting _global variables and was told that an array may solve my problem. I need to convert the code below to an array, but I'm a newbie when it comes to _global arrays.
How can I convert this?
Quote:
//ROLLOVER
/////////////////////////////////////////////
on (rollOver) { this.button2 = true; }
on (rollOut) { this.button2 = false; }
//SETS BUTTON OVER STATES
/////////////////////////////////////////////
on(press) {
for (var i in _global) delete _global[i];
_global.button2_on = true; }
// ROLLOVER FUNCTION (First Frame of MC)
/////////////////////////////////////////////////
this.onEnterFrame = function() {
if (button2) {
this.gotoAndStop(9);
_global.main_over = true;
} else {
this.prevFrame();
}
if (button2_on) {
this.gotoAndStop(9);
_global.main_on = true;
}
};
Change _global Variables To _global Array?
I'm having a problem with conflicting _global variables and was told that an array may solve my problem. I need to convert the code below to an array, but I'm a newbie when it comes to _global arrays.
How can I convert this?
Quote:
//ROLLOVER
/////////////////////////////////////////////
on (rollOver) { this.button2 = true; }
on (rollOut) { this.button2 = false; }
//SETS BUTTON OVER STATES
/////////////////////////////////////////////
on(press) {
for (var i in _global) delete _global[i];
_global.button2_on = true; }
// ROLLOVER FUNCTION (First Frame of MC)
/////////////////////////////////////////////////
this.onEnterFrame = function() {
if (button2) {
this.gotoAndStop(9);
_global.main_over = true;
} else {
this.prevFrame();
}
if (button2_on) {
this.gotoAndStop(9);
_global.main_on = true;
}
};
Here's an example of the menu: www.earph.com/test.html
Change _global Variables To _global Array?
I'm having a problem with conflicting _global variables and was told that an array may solve my problem. I need to convert the code below to an array, but I'm a newbie when it comes to _global arrays.
How can I convert this?
Quote:
//ROLLOVER
/////////////////////////////////////////////
on (rollOver) { this.button2 = true; }
on (rollOut) { this.button2 = false; }
//SETS BUTTON OVER STATES
/////////////////////////////////////////////
on(press) {
for (var i in _global) delete _global[i];
_global.button2_on = true; }
// ROLLOVER FUNCTION (First Frame of MC)
/////////////////////////////////////////////////
this.onEnterFrame = function() {
if (button2) {
this.gotoAndStop(9);
_global.main_over = true;
} else {
this.prevFrame();
}
if (button2_on) {
this.gotoAndStop(9);
_global.main_on = true;
}
};
Here's an example of the menu: www.earph.com/test.html
_global.var[i] Versus _global.var
Hello!
I simply can't understand this...
Code:
//works perfectly
_global.src = film.attributes.src;
trace(_global.src);
//returns undefined
_global.src[i] = film.attributes.src;
trace(_global.src[i]);
This is inside a function + a for-loop, so I really need the _global-stuff together with an array...
Thanks for any input!
Robin
Does Anyone Know What "_global ? _global : _level0._root;" Does?
I have some script from a company and they are using the following statement:
g = _global ? _global : _level0._root;
I assume this is setting a variable g to test to see if something is global at level 0 of the root. Is this correct? I do not see this syntax in any of the references.
_global ?
When would one use _global. ? When is it used over say, _root. or _parent. ?
_global Help
Hello. From my Lingo days I used global all the time. Now that I've phased Flash in, I've been using _root.targetPath. I'm getting sick of typing a path every time I reference a var. Could someone explain the _global syntax and if there is an obvious advantage to either. You're a great help (in advance).
Thank you,
1M.
_Global
Hi all,
I been wondering anyone can show me a simple example on using global level. I have a hard time trying to figure it out. I'm using flash MX.
Pls help me.Thx
Marv
_global What The F
Ok I downloaded an awsome RPG sample from here at flashkit. and i have been playing around with it trying to lanr stuff so i an someday make my own. But in the movie it has Items.... it says they are _global bla bla in the actionscript thing rather than starting with.root I cant access the _global files anywhere in the movie its driving me nuts! anyone know what im doing wrong or what i need to do to find this movie clip or w.e i am actually looking for to make my own items? Please Help. Thanks alot
Matt
What's Up With _global?
I use an onLoad function to set some global variables in the main movie. Then in loaded movies, I reset it to another number, so I can use some if statements to read whatever the global is "now" and perform the appropriate actions. This works, twice, but not a third time or beyond.
Change the _global to _root, and it works, all the time. Can someone explain that, or at least tell me it's a known bug?
[F8] _global. And Over?
Hey im using this code at the moment:-
Code:
if(_global.block == 7){
_root.b3.start();
}
is there a way I can make it so its 7 and over so it doesn't have to be exactly 7 but like 8, 9, and 10 and keep going???
_global?
I have several text boxes which I want to display various text strings when the user clicks on a variety of buttons. These buttons are nested in a variety of locations so I have them set _global.InfoBox = "Work for me"; and inturn I have a dynamic text box in an MC with the variable set to _global.InfoBox.
But it dont work! I've done stuff similar before. Is _global hosing me, or is it something else?
Using _global
hey all,
i wanted to assign a value to an object one time, as it doesn't change in any sections - i.e. stylesheet, why does blow code not work? : i want to get rid of multiple instances i have in different sections but maybe i'm not doing this right?
this is in the root
ActionScript Code:
_global.txtContent._copy.styleSheet = styleObj;
_global.txtContent._copy.autoSize = "center";
_global.txtContent._y = 260-_global.txtContent._height;
anyone? thanks in advance.
No _global In AS3?
I realize this is basic stuff, but if I have created a master swf to hold additional loaded swfs, how do I name the master so I can refer to it and navigate within its timeline? I did this in AS2 with _global.master = this; I navigated to various labels in the master swf by clicking on buttons in the loaded swfs. With _global gone, I have no idea how to name the master so I can navigate within the master movie timeline. Any help?
Var _global.name:XML = New XML();
Quote:
var _global.xml_container:XML = new XML();
is of course not working.
Yes, I have googled and found the senocular solution but the forkaround
Quote:
_global.xml_container=null;
with (_global) var xml_container:XML = new XML();
is not working for XML.
Have anyone solved this? Please descibe how.
PS! I need the XML container to be _global, as I have to pass the XML to an other .swfs included later on.
_global In AS3 ...
Hi everyone,
i'm working with Flash CS3 and i'm doing an application with AS3.
right, i need use a global variable and i have problem with this..
in AS2 i just do it: _global.var = "hello world";
but readind Flash Help i see that function is REMOVED!
anybady know how i do it? for declaring a global veriable?
sorry for my english, i'm from Brazil.
Hugs!
_global.
Can anyone explain to me the usage of _global. better than the reference in 'MX does? I've used _global vars, NOT _global vars, AND a mixture of both, to have all three options work w/in multiple scenes, and I'd like to know a little more about when/where to use _global. . . anyone?
_global Help
Okay, I really have no idea why _global doesn't seem to be working for me but here is my code:
_global.xmlref=null
_global.xmlarray=null
function doload() {
xmlarray=new Array(3);
}
function loadContent() {
var p=page
xmlref=new XML();
xmlref.ignoreWhite=true;
xmlref.onLoad=function(suck) {
if(suck) {
doload();
}
}
xmlref.load(p);
}
loadContent()
trace(xmlarray)
Now to me xmlarray should contain Undefined, Undefined, Undefined yet it says null when I execute this. If someone can lead me in the right direction as to how to referenced _globals it would be appreciated. It seems that if dload() is inside the onLoad function then it does not reference globals correctly. And I also tried adding _global to all references but it still does not work. I this a bug or am I doing something wrong? Thanks
_global On As3.0
i have multiple swf in a project and i want to comunicate bettween them using a global var or a root var. in as2 i just called:
_root.VarOnTheRoot="something"
or
_global.VarOnTheRoot="something"
and i could use it whenever i wanted. now with as3 this doesnt seem to work,
thanks for the help
_global.
Can anyone explain to me the usage of _global. better than the reference in 'MX does? I've used _global vars, NOT _global vars, AND a mixture of both, to have all three options work w/in multiple scenes, and I'd like to know a little more about when/where to use _global. . . anyone?
_global Help
Okay, I really have no idea why _global doesn't seem to be working for me but here is my code:
_global.xmlref=null
_global.xmlarray=null
function doload() {
xmlarray=new Array(3);
}
function loadContent() {
var p=page
xmlref=new XML();
xmlref.ignoreWhite=true;
xmlref.onLoad=function(suck) {
if(suck) {
doload();
}
}
xmlref.load(p);
}
loadContent()
trace(xmlarray)
Now to me xmlarray should contain Undefined, Undefined, Undefined yet it says null when I execute this. If someone can lead me in the right direction as to how to referenced _globals it would be appreciated. It seems that if dload() is inside the onLoad function then it does not reference globals correctly. And I also tried adding _global to all references but it still does not work. I this a bug or am I doing something wrong? Thanks
Uses Of _global
Hallo,
I'm trying to hack some code with the _global scope, but sometimes it fails, and I have to put the _global prefix always, in front of each reference in the movie.
Does it work with variables only? Or with objects also? Say _global.mySound = new Sound(), is it feasible? Can I call it from wherever in the timeline, even loaded levels?
thank you very much!!
m.
When To Re-use _global.?
Hello, in my program I'm using a lot of global variables. I've noticed (especially with global arrays) that if I do NOT use the _global identifier when doing a complete reset of the arrays data, it doesn't always work.
Just to clairify, what I mean by a complete reset is looping through the array using a temp array to hold the valued I want to save then applying the temp array to the original arrray thus overwriting the original. I realize array.slice would be better, but humor me.
And on the flipside, I have some regualr number global variables that will NOT CHANGE when I try to re-set them to 0 if I use the global identifier on them.
So, what is it i'm missing, what is it I don't know about _global that's screwing me up?
Thanks.
_global HELP
Hi, I'm trying to control a movieClip in level20 from a loaded movie,
elements:
movie1
navigation
index(main movie level0)
I load movie1 from index(_level0) to _level5,
and load navigation(stand alone movie) from movie1 to _level10,
now I want to control a movieClip in navigation movie(_level10),
I put a function in index(_level0), I'm not sure if I could do this or not, but here is the code in index(_level0) first frame...
_global.function moveIt(myClip){
endy = 100;
speed = endy - myClip._y;
myClip._y += speed/5;
}
I just wondering if I could make a _global function in level0 and control eveything which being loaded into it.
so I can call it from movie1(_level5)
moveIt(someClip);
is that right?
can anyone tell me if can I write a _global.function()?....
does the _global.function() thing exist??
_global XML?
I have 3 swf's which are all linked to the same XML file. I have created a main swf which contain buttons which load the respective external swf using loadMovie.
Since the XML file is the same in all 3 - I was wondering, could I pull the XML loading information from each of the three swf files and put it in the main swf so that it only loads and parses the XML once and then each of the 3 swfs can pull the dynamic data from it there?
It seems like this would be faster and more effective way to do this?
_global Isn't Global
if i do this:
_global.hello="hello";
then anywhere in my movie i can say:
var another;
another=hello;
and another will be set to "hello"
and will be accessible from ANYWHERE in the movie
when i do this though:
_root.createEmptyMovieClip("newmovie",depth);
_root.newmovie.loadMovie(url);
then newmovie can't see the _global.hello
it can't even see anything in _root or _level0!
but when i use the debugger it shows that
_global has all _globals created both in the main movie
and in newmovie
is _global really global ?
can someone please tell me what i am missing here ?
or is _global really not global at all ?
thanks for any consideration
anilgulati
_global Problem ?
Hi ,
I have three scenes in my movie. The second scene contains a quiz game. I am counting number of questions asked and right and wrong answers. I am declaring all these variables as _global.rightAnswer= 0; so on.... in my first frame of Scene 2.
The problem happens when user jumps back to scene 2 from scene 3 . The previous information already exists. such as questions , answers etec.
How can I fix it? Please reply asap
_global On A Button? MX
Is There a way to put a _global on a button instead of a timeline to trigger the action. Right now the only way to get it to work is to have it on the timeline. What I need to do is have it on a button so that when the user clicks, the actionscript will cause the _global to work. I may not be explaining enough so if not let me know and I will try...it's somewhat confusing to me so I'll do my best.
Actually I guess I should rephrase it a little, I just checked and I can't get it to work on the timeline either. I've posted the file here for visual referance.
www.rustygeorge.com/Quiz Practice 1.fla
_global Variables
I'm having quite a time getting this _global variables thing to work for me. I have these 4 buttons that will take you to Lessons 1,2,3, & 4 respectively. now, in Lesson 1 I have a MC with 10 different buttons. when the user clicks any of the buttons i want a check mark to appear next to it to show that he/she has seen the MC that pops up.
Frame 1 reads:
if (_global.pub1=0) {
pubck1._visible = 0;
} else {
pubck1._visible = 1; {
button 1 (of 10) in this MC has the action:
on (release) {
gotoAndStop(2);
_global.pub1=1;
}{
now, in the timeline of this MC, i have dynamic textboxes that are labeled _global.pub1 - _global.pub10 (off the stage). I have 10 additional MCs that are labeld (pubck1 - pubck2). These should be invisible (see 1st code above) unless the user has already clicked the corresponding button which will change the value of it's var to 1. The first frame of code (above) is for pubck1... pubck2 - pubck10 would be included as well.
I need these variables (pub1 - pub10) to be global because i want the user to go to lesson 2 and perhaps return to lesson 1 and see which pubs he/she has clicked on.
as of now, when i go into lesson 1, i see the pubck MCs even though i haven't clicke any buttons. Ayudame, por favor!
_root & _global
what is the diference between
_root.score;
_global.score;
i think u all are global values
thnx in advance
_global Variable ?
In a flash movie i got say 50 frames. Including the flash home (Frame 1) all the the pages have got voiceovers, In the first frame the user got to listen the voiceover which is essential for the tutorial module, by default i have designed so, whenever the user navigate the 49 pages the releavant voiceover will be loaded as a movie clip in the relevant frame.
Now i have added a preloader and option disable button while downloading the voice called "D", if someone doesnt want to listen the voiceover they can hit D key in the keyboard and stop that voiceover clip while getting loaded.
But practically, in each frame the user may get iritated for hitting that D key if he doesnt want to listen to that voiceover !
say in the flash home (Frame 1), Can i set 2 option buttons "Audio Version & Audio less version" and set _global variable for the 2, which can watch in the rest of the frames and disable or enable that voiceover clip getting loaded or unloaded in each frames depending on
the version the user selected in the flash home (frame 1) ?
is there anything to do with Object.__proto_ or custom class constructor or anyother function?
Actionscript With For And _global.
hy
somebody can help me.
i need to transform this next code in a simple code using
FOR (1;i<=10;i++)
my code:
_global.rep1a = "";
_global.rep1b = "";
_global.rep2a = "";
_global.rep2b = "";
_global.rep3a = "";
_global.rep3b = "";
_global.rep4a = "";
_global.rep4b = "";
_global.rep5a = "";
_global.rep5b = "";
_global.rep6a = "";
_global.rep6b = "";
_global.rep7a = "";
_global.rep7b = "";
_global.rep8a = "";
_global.rep8b = "";
_global.rep9a = "";
_global.rep9b = "";
_global.rep10a = "";
_global.rep10b = "";
I try to do like this but doesn't work
for (1;i<=10;i++) {
_global.rep[i]a = "";
_global.rep[i]b = "";
}
I'm using flash MX
Thanks
FOR (1;i<=10;i++)
_global... I'm Doing Something Stupid Here
This must be simple but I can't figure it out..
I've got movie1.swf and that loads movie2.swf into it ok?
in movie1.swf I declare _global.var1 = "hello"
ok?
Then, as a test, I have a button in movie1.swf with:
on(press){
trace(_global.var1)
}
and, sure enough, when testing, it traces "hello"
but, if I have a similar button in movie2.swf (which, remember is loaded into movie1.swf) with exactly the same code:
on(press){
trace(_global.var1)
}
I get "undefined"
Why???
I thought _global.var1 would be available everywhere, even to other swfs loaded into the main movie??
_global Variables
Hi
How can I use a variable that resides inside a function elsewhere I have tried declaring it as _global but still its undefined unless its in side the function. I need to use the contents of result_lloyd to be inserted into a label from a separate function.
one_stepperListener = new Object();
one_stepperListener.change = function(eventObject) {
_global.result_lloyd = "Flash 8";
};
one_stepper.addEventListener("change", one_stepperListener);
Thanks for any help.
[MX] Help With _global Function
This works perfectly
Code:
_global.disableBtn = function(btn_name){
disabledColor = new Color(btn_name);
disabledColor.setRGB(disabled_color);
}
disableBtn(_level100.parBtn_text);
But why doesn't this work?
Code:
_global.disableBtn = function(btn_name){
disabledColor = new Color(_level100[btn_name]);
disabledColor.setRGB(disabled_color);
}
disableBtn(parBtn_text);
I want to put the level inside the function so I don't have to write it all the time.
_global Functions
Hi,
I am just getting to grip with functions and have come across a problem.
I would like to call the function written on the root from other mc timelines.
I understand that I need to use _global functions. I have tried to convert my function to a _global with no sucess.
function wait(number) {
stop();
var myInterval = setInterval(function () {
play();
clearInterval(myInterval);
}, number*1000);
}
I then call it with -------- wait(2);
Could someone please help, I have a feeling its a very simple solution.
Thanks
[F8] _global.causinMeProblems
I am working with a working with flash 8 and the external interface class. Finally got it to work the way I need it to, but now I run into the problem if I try to set the return result from a javascript to a global variable, flash runs slow the prompts me to abort script prompt. If I use a local variable it works fine I guess this is a s00per u00ber n00ber question, but how would I get a non global variable from frame 1 to frame 2-3.
here is the code
Code:
_global.suspendData = 0;
var suspend:String
suspend = ExternalInterface.call("apiCall","getValue","cmi.suspend_data").toString();
//this is where the code cause flash to abort the script
_global.suspendData = suspend;
[F8] Returned Value Set To _global
i just need to know how to make the variable $access = what is returned from the PHP script
on (release)
{
if(userName.length > 0 && userPassword.length > 0)
{
myVars = new LoadVars();
myVars.username = userName.text
myVars.pass = userPassword.text
myVars.action = 'login';
myVars.sendAndLoad(php_file, myVars, 'POST');
myVars.onLoad = function()
{
if(!this.error && this.user > 0)
{
myVars2.action = 'access';
myVars2.sendAndLoad(php_file, myVars, 'POST');
myVars2.onLoad = function()
{ _global.$access = }
_root.gotoAndStop('registered');
} else {
_root.gotoAndStop('no_registered');
}
userName.selectable = true;
userPassword.selectable = true;
loginButton.enabled = true;
}
userName.selectable = false;
userPassword.selectable = false;
loginButton.enabled = false;
}
}
PS: this will allow me to call that variable later even if I have loaded a movie to lvl 0?
[F8] _global.TextInput
Im building an application in flash 8 / as1, and it consists of about 100 TextInput component fields.
Instead of writing the same rules 100 times, is it possible to globalize the functionality listed below? Thanks!
PHP Code:
_global.TextInput.restrict = "0-9\-";
and/or
var _global.TextInput:mx.controls.TextInput;
var tiListener:Object = new Object();
tiListener.focusOut = function(evt_obj:Object) {
//calcualte all fields
};
_global.TextInput.addEventListener("focusOut", tiListener);
Replacement To _global In AS3 *Help*
Ok, after searching for hours, I give up! Can somebody explain clearly the AS3 code to achieve what _global used to do in AS2?
Basically, I have a first swf in which I load a second swf. A string variable in the first swf needs to be used in the second. In AS2, I would use _global to set the variable and being able to use in the second swf, but as we know, it doesn't exist anymore in AS3.
I have tried some package examples but I get an error saying the package cannot be nested.
Thanks if you have any tip!
[F8] _local To _global How?
i have some problem when i am loading swf into swf the sound on the buttons doesn't work
(if i come into my flash direcly it's work but the preloader doesn't work)
how can i make my command from _local to _global , i would like to get explain
this is the code i used.
the button code:
Code:
on (release) {
_root.HomePage();
}
Quote:
function HomePage() {
gotoPage(page-2==0);
}
[CS3] _global Question
Hi Guys,
I have a movie clip and on each frame that requires actions I have script like this:
switch (_global.Next_Scene) {
case 1:
Trace ("scene1");
setProperty("/scroll", _x, -(Number(0)));
_root.gotoAndStop("f1");
_root.globe.stop_where = "ita";
_root.globe.play();
if (Number(test) == 1) {
test = 0;
}
break;
case 2:
Trace ("scene2");
setProperty("/scroll", _x, -(Number(mw)));
_root.gotoAndStop("f2");
_root.globe.stop_where = "par";
_root.globe.play();
if (Number(test) == 1) {
test = 0;
}
break;
default:
Trace ("default");
}
And on the buttons I have code like this:
on (release) {
_global.Next_Scene = 2;
play();
}
I now have code everywhere and am wondering if it is possible put the _global code in a movie that can be called when the button is clicked rather than having the _global code in every frame that uses it in the timeline?
I hope that makes sense
|