ActionScript 3.0 :: Access Variables From A Movie Within A Movie?
Jul 23, 2009
I have a movie, let's say MainMovie. Within this movie I have another movie, let's call it MovieWithin.
I have a few variables in the MainMovie such as MyColour, MyHeight, etc.
In the MovieWithin, I want to place the following code:
onload()
{
ThisColour = _root.MyColour;
ThisHeight = _root.MyHeight;
}
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.
View 0 Replies
Similar Posts:
Oct 1, 2009
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?
View 4 Replies
Jun 30, 2005
How do I access variables on the main scene from inside a movie clip.
I have a variable called player health, and inside the movie clip I want to do this, playerhealth -= 20, but its not working
View 10 Replies
May 28, 2002
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.
View 4 Replies
Jun 4, 2002
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.
View 14 Replies
Jun 14, 2007
i got a school flash project where i need to access the _y properties of many movie clips buttons that set with name like sel 1 sel2 sel 3 and so on the problem is i have 2 sets of those, one on the main timeline which i can access with "for" looped _root["sel"+i]._y and one which is inside another movieclip problem is i don't know how to access the later using for loop? this is the script that i used to access the _y on the _root.selx
[Code]...
View 4 Replies
Feb 11, 2012
i made a movie clip name floor, and inside it are movieclips called plan0, plan1, plan2, plan2, and so on.
so to make it easy, it put the movieclips inside the floor movieclip into an array, like this:
daFloor = new Array();
for(a=0; a<10; a++){
daFloor[a] = "plan"+a
}
[Code]....
both didn;t work. how to access the inside movieclips through array;
View 2 Replies
May 22, 2011
I'm making obstacles for my game, and basically what I have is a movieclip called char on the maintimeline and a movieclip called floor.. within the movieclip floor i put a movieclip called obstacle in. What I want to do is check to see if char hit obstacle, so itd be like hitTestObject(floor.obstacle) then make the main timeline go to frame 2..
View 1 Replies
Dec 3, 2009
I'm currently making an animation which will eventually exceed the 16,000 frame limit (don't ask haha), so, short of making two movies and having to just start up the next one, what is the code for loading a movie? I presume they need to be in the same directory? So basically all I want is on the last frame of the movie the code executes and the second movie file opens up and starts. I guess I'd want the current movie to close, too.
View 1 Replies
Feb 12, 2009
I Have 3 Movies:MAIN.SWF, contains loading movie actions for Nav.swf and Home.swf.NAV.SWF, contains navagation menu loaded on Level 2 in Main HOME.SWF, contains slideshow for home page loaded on Level 1 in Main In NAV.SWF, there is a MOVIE CLIP "graphmc", which contains a BUTTON "graphicbtn", When this button is clicked, I'd like the HOME.SWF (which is loaded into Main.swf on Level 1) to fade out and unload, and load and fade in Graphics.SWF in place of it.
View 6 Replies
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
View 4 Replies
Jan 28, 2009
I keep having problems with variables in movie clips
_level0.NumberSectionsEntry.ThreeMeterBays
keeps appearing in the text fields
if I change the variables on the text field in hte mc from ThreeMeterBays to _root.ThreeMeterBays they work do all variables have to call _root?
View 2 Replies
May 26, 2010
So I have used this code:
_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.
View 0 Replies
May 17, 2005
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.
View 14 Replies
Feb 7, 2008
which is the use of having "variable movieClips"?? ...I mean, if I have this:
Code:
var SuperAwesomeGuy:MovieClip = new MovieClip()
the only usefull things I could do with it is the following (which is very usefull if you are using a "for...in"):
Code:
var variableMovie:MovieClip = _root.attachMovie("movie","movie-with-complicated-name"+i,random_depth)
variableMovie._x = 200
variableMovie._y = 500
and I didn't found anything else useful...
View 1 Replies
Feb 3, 2009
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.
View 3 Replies
Apr 14, 2012
Is there a there a way to run a movie with url variables passed? So instead of test.swf, it would run as test.swf?var=1&var2=2
View 1 Replies
Apr 26, 2009
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) {
[code].....
View 1 Replies
Feb 2, 2012
I want to change variables on the main stage's code from within a movie clip.
Say for example, I want to change a variable called 'chair'
In AS2, this is how I would do it:
(on the main stage)
Code:
chair = 2;
(in the movie clip)
[Code].....
But all I get is a 1119 error saying 'Access of possibly undefined property chair through a reference with static type flash.displayisplayObject.'
View 3 Replies
Jan 21, 2010
How can I trace all available Movie Clip variables and functions?
View 5 Replies
Apr 27, 2010
How i can convert gecko object to a movie clip
function finish(boxname, arrayname:Array):void {
for each (var item:String in arrayname) {
trace(boxname+"_"+item);
[Code]....
View 2 Replies
Nov 10, 2009
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?
View 1 Replies
Jan 19, 2005
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});
View 3 Replies
May 18, 2003
some variables are inside of a movie clip, and i can't seem to access them from the main timeline.
View 5 Replies
May 22, 2003
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")
View 1 Replies
Jul 7, 2009
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.
View 1 Replies
Aug 31, 2009
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!
View 1 Replies
Sep 22, 2003
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
View 2 Replies
Apr 5, 2004
I need to read some variables into a flash movie. Can I do this with javascript or the <param> tags?
View 3 Replies
Jan 19, 2005
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
dot.duplicateMovieClip("dot"+currdot, this.getNextHighestDepth(), {_x: xpos, _y:ypos});
View 3 Replies