ActionScript 2.0 :: Global Variable Undefined On Main Movie
Jul 16, 2004
I'm working with three files. Main.swf which contains navigation.swf in a blankmc, empty mc called mcContent where navigation sleclected materials are loaded.
In the navigation.fla here is the code
[AS]trace("now defining global");
_global.loadFile_str = strPicName;
trace("global defined as");
[Code] .....
When I do a trace of loadFile_str in the first frame of monthlyreports I get a undefined. I have tried trace(loadFile_str) and trace(_global.loadFile_str). I also noticed that if I define the global on the main movie (it maintains the global variable, the navigation fla will not overwrite it).
View 5 Replies
Similar Posts:
Apr 21, 2004
im going through colin moock's book, "the definitive guide", and im learning about global variables. so in his lesson he says to do this:
1. create a movieclip called square, with a square inside of it.
2. in the square mc's timeline, on frame 1, place this code :
_global.day = "tuesday";
3. go back to the main timeline and on frame one put this code:
trace(day);
no according to moock, when i run the movie, it should output "tuesday", but all i keep getting is "undefined"
View 8 Replies
Jul 16, 2004
here is the set up. I'm working with three files. Main.swf which contains navigation.swf in a blankmc, empty mc called mcContent where navigation sleclected materials are loaded.
In the navigation.fla here is the code
[AS]trace("now defining global");
_global.loadFile_str = strPicName;
[code]......
View 5 Replies
Feb 8, 2010
I have 2 movie clips, one being loaded into a container MC via "loadMovie();"In the main movie there is a variable with no value, in the external movie there are 5 frames, each with a value to update the variable in the main movie.
IE: if on frame 1, global value = 1 / if on frame 2, global value = 2 / etc etc I'm familiar with passing variables INTO an external swf, but am stumped on how to do it the reverse way.
View 1 Replies
Mar 27, 2006
Both files are running on the same domain.I am simply calling a another movie within a movie using the global variable feature.Howver even hardcoding the variable _global.directionsText the import-html.swf movie returns a undefined error
Code:
//Frame 1 - Actionscript from Calling Movie
_global.directionsText="http://www.mysite.com/access_db/viki...ive/myHTML.txt";[code].....
View 1 Replies
Oct 28, 2009
I need to create a global var in AS3 so that I can create the var on the main timeline and change it within another movie clip.
View 3 Replies
Apr 3, 2003
If a variable is declared in a movie as global (_global). Is this variable available to a movie which loads this movie via LoadMovie()?
i.e. parentMovie loads childMovie.swf
View 2 Replies
Feb 11, 2004
Im using loadMovie in a parent movie to load my content movies. I need the content movies to be able to access a variable set in the content movie. I've tried using global variables and can't seem to get anything going.
I've got two layers. The top layer has the header and footer graphic alongs with the scripting for the menu. The bottom layer is where the content movie is loaded into.I'm declaring the _global variable in the top layer, outside of any functions, and trying to access it from the loaded swf in the content (bottom) layer.
View 3 Replies
Jun 26, 2008
I have an array holding 'image' and 'name' name loops fine and populates a load of movie clips underneath each other... i need for when this name is clicked to load an image in another movie clip (image name comes from the array).. the code i have works but it only pulls throught the last item of the array which points to a problem with 'i' not being carried across the functions..? that is the result of my investigation *smokes pipe*
[Code]....
View 8 Replies
Jul 22, 2009
i defined the global variable in the first frame of my file, and i can access it on other frames, however i am trying to access it within a movieclip, and flash is telling me that it is undefined. does anyone know why this could be?
View 1 Replies
Sep 4, 2008
i am using flash cs3,i have a main movie that load many swf using a document class..i need to pass "userid" variable from the main movie to loaded swf so they can change their content dynamically.
View 7 Replies
Mar 28, 2012
I have a Flash Professionl AS3 project I am working on.
I have this in a main movie:
but1b.addEventListener(MouseEvent.CLICK, fbut1b, false, 0, true);
function fbut1b(e:MouseEvent):void{
var mc:documentwindow_mc=new documentwindow_mc();
mc.x=450;
[Code].....
The issue I have is I need to do this 40 times.
Is there a way for me to use the same documentwindow_mc movie clip and pass a variable to change the "documents/print2flashdocument1a.swf", part?
How could I do this from the fbut1b function?
View 3 Replies
Jan 14, 2004
i want to load variable from text file to my main movie (swf file).what should i put in the second parameter of the function loadVariables ("target" parameter) - should i insert _this? _parent? _global? (nothing works...)
View 3 Replies
Oct 9, 2008
How to read a variable from main.swf (that load content.swf) and use it inside content.swf?
I have a variable called TextColor = "Green" in the main movie and I want to read this variable from inside the content movie?
View 5 Replies
Sep 23, 2010
I'm trying to catch a variable content (set on the main timeline) from a movie clip added to the stage. I need to set a condition with that variable, so here's my line :
Code: Select allif (MovieClip(root).screenMode == ("full"))
But it's not working, I'm also trying to trace the variable with that command :
Code: Select alltrace(MovieClip(root)[screenMode]);
But this doesn't work too.
View 1 Replies
Jan 13, 2004
we have this variable from the internet, val(0), in a dynamic text field we can see a digit from this variable. but when we use this variable in actionscript and test it with trace, the variable shows as undefined.how can we make this work without it coming up as undefined??
View 12 Replies
Dec 23, 2004
I want to load six seperate .swf's into the main movie while the main movie loads too. So in simpler words, i want to be able to load all of the swf's the same time i am loading the main swf.
View 2 Replies
Nov 8, 2011
I'm a begginer flash game developer-ish individual working on my first project - An economic game with RPG elements, I'm mixing AS 3.0 with Flash CS5 (for the graphics, buttons, tweens and the simple stuff in general since it's easier for me atm than scripting it). The trouble started when I had to script in variables. I've sorted out a couple of issues but a few still remain:
1. I need to limit three of my main skills to 0-100. Only managed to stumble across tutorials for AS2,
2. Each character will have 3 main skills, and then the 18 secondary skills will be calculated from those 3 values. This works fine, when I modify existing variables directly in the code. The thing is that I created those buttons that add or subtract from a certain skill value, but when I press them the var changes but all of the 18 skills remain unchanged (as if they do not refresh themselves - i was thinking about an eventListener waiting for a change in skill value but if I would have to do one for every one of the 18 skills in conjunction with the 6 buttons to change levels - so 144 functions - im thinking maybe an array...but I'm such an actionscript newb that I can hardly translate the tutorials into my ideas.
3. Also wondering how to create a pool of unused skill points so when I add points I can't max it out right off the bat but rather take it from that value instead and once it's 0 you can't add points anymore.
4. Last but not least, I'm having trouble creating global values. My main menu is in scene1 and when I press Newgame it goes to scene2, the problem starts when i go back to main menu errors keep showing up (since scene 1 has no information about statistics but a function probably keeps asking )which means that the program can't get access to an attribute or a method of reference for the null object at MainMenu_fla (don't be fooled by the file name, I have everything in 1 fla file)Of course an error pops up for every skill, main or secondary.
View 2 Replies
Mar 1, 2011
how to define global variable in fms so that it can be accesses by different application instance of same application,
View 2 Replies
Feb 28, 2012
I'm trying to get a value from a function which is a URLLoader COMPLETE event but even with declaring variables outside of the function will not allow me to get the value out. I'm stuck.It seems that the Asynchronous nature of Flash makes it impossible to get a value out: e.g. this works:
// Initialise a URLLoader to get XML data from XML file
var myFPBLoader:URLLoader = new URLLoader();
myFPBLoader.load(new URLRequest("flightPlannerBoard.xml"));
[code]...
View 2 Replies
Feb 2, 2010
I cannot seem to find anything of what I need from google.(Well, I can find the reverse method to what i need ) Basically I wish to access a variable declared in the Root Timeline from my Movie clips timeline.
[Code]...
View 2 Replies
Jan 14, 2004
i want to load variable from text file to my main movie (swf file).what should i put in the second parameter of the function loadVariables ("target" parameter) - should i insert _this? _parent? _global? (nothing works.
View 3 Replies
Aug 11, 2009
I have a movieclip on the stage, and in that clip I have a button that is supposed to turn a global variable from true to false, but the compile tells me:
1119: Access of possibly undefined property root through a reference with static type Class.
When I use this code:
Code:
function closeMSN(event:MouseEvent):void{
this.visible = false
Stage.MSNOpen = false
}
I know how to reference the movieclip itself by this, but how do I change the value of a variable on the main stage, from inside the movie clip?
View 3 Replies
Jun 23, 2009
i've declared global variable in the first frame of the main timeline:var cLabel:String;In the inner timeline of a MC, i use this code:stop();cLabel=this.currentLabel;but flash gave me error 1120: access of undefined property
View 6 Replies
Aug 24, 2009
I'm having an issue with a global variable. I'm trying to give it a value within a function and it isn't working.The variable is imageList. It's an XML List. I'm making it global so I can use it anywhere in my project. I suppose if someone has a better idea to avoid the global variable, I'm up for that too. But for now, it seems like the way to go.
Here's my .as file:
package
{
public class MyGlobal
{
[code]....
It's giving me the same same Error #1009 as above. It seems like a scope problem, but why? Shouldn't it work since it's a global variable?
View 6 Replies
Jan 8, 2010
I am trying to set up a global variable. On the root of my timeline, I have this;
_global.floorVar = "0";
trace(floorVar);
which seems to trace fine to say 0.
Then, inside of a movie clip on the main timeline, I have a button function:
floor1.onRelease = function() { _global.floorVar = "1"; trace(_global.floorVar) _root.gotoAndStop(2);};
if (_global.floorVar == 1) { trace("it works");
}
It traces as 1 once I press the button, but the if statement doesn't trace "it works" is my global variable set up wrong?
View 7 Replies
Jan 21, 2011
var frName = fruit_txt.text;
disp_btn.addEventListener(MouseEvent.CLICK, disp_fruit);
function disp_fruit(Event:MouseEvent)[code]....
defining the variable i:e frName.... outside the function it does not display anything..same time if I define same variable inside function i:e disp_fruit...it displays the name ]why?
and how can i use variable i:e frName as global var so that it can be used in any function?
View 2 Replies
Feb 1, 2011
I have a stackview of textfields and when I type into the text field I want it to update on each stackview "page", kind of like a global variable, maybe even using a global variable.
View 1 Replies
Jul 21, 2009
Can I bring in a variable (saved in a text file) using LoadVars and then make that variable accessible from anywhere in the script (i.e. make the variable a global)?
View 1 Replies
Jan 10, 2010
how do I make a global variable that can be recognized in all frames?
View 1 Replies