ActionScript 3.0 :: Alternatives To _global Variable Path?
Jun 8, 2009
through out a very old complicated fla there are buttons which set variables using _global paths
such as:
function menu1_2(Event:MouseEvent) {
global.mode = "hide_hotbox";
MovieClip(this).gotoAndStop("stage_1_b");
}
How can I make the variable "hide_hotbox" and others like it accessible and changeable from any movie clip -- whether they be nested in other movie clips or on the main timeline, etc?
I have a swf page where the external swf will load, there is any way to declare variables who work in all swf. What I am trying to do is: like a switch, with several options in which all these are listed in the main swf
I'm getting frustrating Why in Gods name this example doesn work???kirupa2 loads kirupa1 in which is _gloal variable setup (_global._myVariable = "XYZ")After clicking on PLAY button trace outcome is undefined
I need to pass the value of a attribute to a _global variable that can be accessed somewhere else in the movie.But it traces as undefined outside of onLoad.
eg.FRAME ONE
ActionScript Code: var xml:XML = new XML(); xml.ignoreWhite = true;
I have recently started making (and am still making) the transition from ActionScript 2 to 3. I have used the _global variable in an AS2 project as I needed a variable to be accessible from within ANY swf loaded into my main movie. This worked like a treat.
However, along came AS3 and whipped that from right under my feet. After much Googling, a few people suggested making use of a simple class with a simple variable that can be publicly set and retrieved. I made a simple class, imported it and manipulated the value, and all went well, however the instance of the class I create in my main loader movie is still not accessible from within a second SWF that gets loaded into my movie. If I re-instantiate the class in the SWF that is being dynamically loaded, the value reverts to the default value in the class code, not the new value set in my parent (first) movie.
Here is my class code, stored in an external .as file, is there any way I can simulate the ostype variable being a global variable?
package{ public class ostype { public var ismac:Boolean = false;
[code]....
it's used as a simple identifier as to what operating system this flash app is being used on (mac or windows) and as a result let's me server content - such as saving files - in a different manner.
I was wondering how I might change this to a "local" function instead of "_global". I've been trying, but my syntax is either screwed up or just just plain doesn't work.
I have several UIs and wish to automatically load images into the containers. I have repeated the actionscript line, which has created a lot of code.As the lines are similar all but the image number, I am thinking to use a loop and variable to insert the image number into the code. Here is the code:[code]a variable to replace the number between I am not sure how to do the same for the Movie Clip path.Is it possible to use a variable to define the number (2) in this statement?
I am trying to create an xml based site navigation that will drill down to an infinite number of xml levels. I have tried to send an xml path as a variable with the currently selected menu item but I doesn't seem to work. Here is my code, it seems as though it should work, but it does not.
The bold below is what I would like to work, however it does not. It might not be able to happen like this at all.
basically on mouse down I take the event.target.name and perform a string manipulation to get the number out of the target and add some string to front and end to get the name of the movieclip I would like to effect. Is it possible to insert the value of dotName into the path?
eventName = event.target.name; stringManip1 = eventName.substring(13, eventName.indexOf("_")); //get the Number before the _ dotName = "dot" + stringManip1 +"_mc"
I have a variable that is refers to the names of folders, and I need to insert the variable into the pathname when I loadMovie. I cannot seem to get the variable to become part of the pathname
loadMovie('VARIABLE/image.jpg', _root.loadhere);
I've tried parenthesis, [], (), do not know the correct way to call the variable.
I have a menu with 4 tabs. When I click on one I want it to open and the previous one to close.
I'm storing the previous tab as a variable (_previousTab) but am having trouble adding the variable to the path to the MovieClip of the previous tab. The error Flash gives me is:
TypeError: Error #1010: A term is undefined and has no properties. at MenuRun/menuOpen()
[Code]....
If I replace mainframe[_previousTab] with the name of the MovieClip it works fine. I'm thinking it's something to do with the variable being a String perhaps?
I need to load an external SWF into a movieclip, and get the name of the SWF from a variable from a class. The variable is called getSWF and is defined as the following in the class
public var getSWF = "movie.swf";
When I trace(getSWF); on the first frame of the main time line it outputs fine. However when I use the following code on the movieclip:
var imageRequest:URLRequest = new URLRequest (getSWF); var imageLoader:Loader = new Loader(); imageLoader.load(imageRequest); addChild(imageLoader);
I'd like some help on using a variable in a path to a MovieClip. I have a menu with 4 tabs. When I click on one I want it to open and the previous one to close.
I'm storing the previous tab as a variable (_previousTab) but am having trouble adding the variable to the path to the MovieClip of the previous tab. The error Flash gives me is:
[Code]...
If I replace the variable _previousTab with the name of the MovieClip it works fine. I'm thinking it's something to do with the variable being a String perhaps?? Also, the trace statements return the desired MovieClip names.
So I've created a script where a mc is clicked on and the player can draw a path using the mouse. I'm trying to figure out how I can get the mc to follow the path drawn out by the player's mouse and when the player clicks again, it erases all of the path.my code is below
How do i control a movie clip which path is contained in a variable? I.E.: I have a variable called: _root.activeButton The variable has this path as a value: _root.buttons.button1 Q: How do I tell _root.buttons.button1 to go to frame 1? I think it is something like this, but I can't remember exactly: [_root.activeButton].gotoAndStop(1)
i have a problem adressing or targetting a attached mc when i target de mc directly it works fine but when i try it trough a variable it doesnt recognise its path anymore??? hopefully a part of the code is gonna explain the situation a litle better... this piece works fine:
Does anyone know whether it would be possible to set a motion path for a movie clip and to have the speed of the tween set as a variable which can be increased or decreased by the user during the movie?