ActionScript 1/2 :: How To Get Value In Movie Variables
Dec 11, 2009
I'm using a Flash accordion component. This component is made of movies and includes text boxes which people can enter locations into. These values are processed on the main stage on the click of a button. My question is, how do i get the value that was entered in the accordion movies into a variable on the main stage that the can be used. At the moment I have a text box on the page, and have added this code to the first frame. Although I think the value is stuck within the movie and cant be accessed on the main stage.
keyword = varkeyword
I'm trying to do a demo with a fastforward button and a rewind button that will go to the next scene and previous scene...however, due to the format that my predecessor created used...I'm stuck with alot of scenes. The navbar (ff and rewind buttons) is in a .swf file called main. The actual demo is in demo3.swf. I created a loader scene to redirect to the correct scene (when ff and rewind are hit), but I'm not sure how to pass the variables needed from the main movie.
Make things very simple, I need to pass variables between different movie clips (.swf's) on my main movie. It seems as tho my variables are only local, not global, i just need to know how to initialize global variables, and how to use the global variables in my other swf's.
So that when it loads I can pass variables to the movie. But this isn't working for me!
It seems that I can access variables going in one direction, but not in the other.
For instance if I was in the MainMovie, and had a code such as: MyHeight = this.MovieWithin.ThisHeight
Then this would work absolutely fine! But if I try to access variables in the other direction, from the inner movie to the outer movie, it just won't have it!
I've tried the _parent technique with no joy!
Basically I want to be able to load several movies (not at the same time!) into my MovieWithin, but be able to control their state on loading by accessing the variables in the MainMovie.
_root.loadvars = new LoadVars(); _root.mainoslataus.onLoad = function(succes) {[code]...........
The problem is that I want to use it at the preloader frame, and display it same time when flash file is loading. But it won't work, it loads when the file has fully loaded, and then its too late.I know that I could use another swf to load this swf and display it then, but its not what I want.
I have a PHP script returning a list of variables to flash. The variables are named something like this:-
photo1 photo2 photo3 price1 price2
[Code]...
How can I create n number of identical movieclips with say three dynamic text boxes in each to show the three variables price, photo and modelnum but will vary with the value of n for each one.
What I am trying to do used to be very simple. I have a variable set in move A. Movie A embeds another move (Movie B) into a movie clip. Is there a simple way to call a varaible from movie a through movie b?If you need a little more detail here is what I am trying to accomplish. Movie a loads a list of information from a xml file and uses that data to set some variables within the content. (ie. based on the data it might caculate that the user listed in the xml file likes golf) Then it sets golf to true in Movie A. My problem is i need this variable throughout several of my movies and I dont want to do the calculation in ever single movie clip. I am sure I am making this much harder than it needs to be.
I am trying to create an interactive flash that users will be able to manipulate certain events in the game. I was was wondering if it was possible to1. Make objects appear or disappear in a frame if a variable is set to a particular number.n example being a window, if you click on it, it opens and closes if clicked on again. If you open the window and go to a different frame, is there a way to make it be open when you go back? 2. Determine the next frame. An example being a door, if the variable is 1 then the door would open when clicked, to the next frame. If it is 0 then it would tell you you need a key or such.I wrapped my head around creating variables and manipulating variables using basic functions.The only thing I am having problems with is if there is an "if"chieve these two tasks.Edit: Figured out number 2:'blueButton' is the variable, when pressed it changes its stored number by two. I linked it to another button which this code is attached to...
PHP Code: on (release) { if (_root.blueButton == 2) {
i am trying to make a basic preloader for an AS3 site. I followed the tutorial on this site (Preloading actionscript 3 the easy way) where its similar to AS 2 - create a Preloader movie and load the whole .swf into it.
only problem is i need some variables that i pass to the movie via QueryString parameters in the Object and embed tags. Is there any way to get this in my loaded movie?
i have tried root.loaderInfo.parameters and stage.loaderInfo.parameters and parent.loaderInfo.parameters
none of them work. Can i create a variable in the prelaoder and just go "parent.thevariable" ? or does parent even work when something is loaded into a loader?
just wondering if theres a way to pass variables to a duplicated movie.Ill be creating duplicate movies very fast (about 20 per second)and want them each to have differrent variables to work with.duplicating with that , and i want to pass 3 variables to the new movie clipdot.duplicateMovieClip("dot"+currdot, this.getNextHighestDepth(), {_x: xpos, _y:ypos});
Can anyone tell me how to set variables in a child movie from a parent movie?[code]but it doesn't work!txtChild is a variable in the child.swf movie. (A dynamic text field with instance name "ChildText")
I am trying to create a flash movie that takes variables from the address bar of the page in which it is contained, and then displays the results.If possible I would like to use PHP in conjunction with flash to achieve this.
I have created a little virtual shop that reads the amount of money a player has and then enables different products to be bought. Eg - if someone has 200 points they can buy a ball for 20 or a bat for 200. This all works fine for one purchase. All of the items check the score and are enabled or disabled fine. However, say I purchase the ball - the points reduces by 20 to 180 - not a problem - but the bat is still enabled even though the variable has reduced so they can't afford it.Is there a way of refreshing the variable so that the items are constantly monitoring the variable amounts?[code]I put it in an mc so that if they buy the item it goes to a different frame where there is no mc to check the myscore var and therefore they've bought it!
I'm having trouble referencing variables in a loaded movie. I read in other posts that you simply refer to the variable as if it belongs to the clip you load it into, however this doesn't seem to be working for me
just wondering if theres a way to pass variables to a duplicated movie. Ill be creating duplicate movies very fast (about 20 per second) and want them each to have differrent variables to work with.
duplicating with that , and i want to pass 3 variables to the new movie clip
I have a movie clip where I store a value in a variable called "yourname" and then load a different .swf file in level 1. I display the value of "yourname" in a dynamic text box, that works fine. I then move on to a frame where the user has an input text box and can re-enter a value for the "yourname" variable, and then clicks a button symbol to reassign the value. Bear in mind, "yourname" was not originally stored on this level and this movie clip, it is stored on level 0 on the first (main) movie clip. Here is my code in the button:
on (release) { _level0.yourname = String (inpt_newName.text); }
inpt_newName is the input text box. My intent here is to have a "main" timeline where variables are stored, and then load and unload various .swf movie clips as needed, storing and variables (i.e. decisions) that the user makes.
I need a way to store variables which I can access from anywhere in a Flash movie (and from any script that is compiled with it). I go about this now that the _global object is gone?
I've build several movies which all work fine, but ultimately they need to run inside a Main movie which acts as a holder for the various child movies which load into it.Everything is working fine but not when they're loaded into the main movie. The main problems seems to be that the main movie has common component which relate to all the loaded child movies.Consequently the main movie has several instances - but how do I refer back to them in the child movieclips?I can't get the child movie clips to compile if I remove the references but ultimately the child movie clips need to speak to instances and functions in the main movie.Also, I've got a global function to hold the global variables but this method seems frowned on. But I need the global variables all the time and in all the movie clips.
1. I made a variable in main.swf, var num:Number = 5, and then i load home.swf, how do i access the var num from home.swf ? In AS2 i can use trace(_root.num), how do i do this in AS3?
2. How do i access a movie clip from different loaded SWF file?
I�m planning to make a magazine in Flash, and I would have to load several pages of it in order. But I�d like to put the buttons forward and previous on the main movie and make then load each page in a container.Is there a way to set variables for each page so the main movie "knows" what movie is loaded at the moment and what page it has to load next.
It is on tracing variables. I have a attached main.fla, movieclip.fla, and movieclip.swf.
If you run main.fla from within flash you'll notice the actionscript on the first frame of main.fla is loading movieclip.swf into an empty movie clip called container on the first frame of main.fla. No problem.
In movieclip.swf I assigned three values to three different variables, a, b and c, on the first frame of moviclip.swf(See movieclip.fla) like this:
a = 1; b="string"; c 1.234556;
Also, in the first frame of main.fla, there was actionscript as follows:
Now each of the above traces produced undefined results when I ran main.fla from within flash. And yes I had complied moviclip.swf. Why did I get undefined results? What concept am I not grasping?