ActionScript 3.0 :: Refering Variables Into A Parent / Main Movie
Aug 4, 2010
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.
View 3 Replies
Similar Posts:
Sep 17, 2009
I have a movie which contains a mc on the main timeline. that mc has a function in it that says
[Code]....
View 2 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
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
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
Feb 29, 2012
Is there some codes, to stop sound in movie clip, when changing keyframe on main (parent) timeline ?
View 1 Replies
Jan 23, 2012
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?
View 9 Replies
Mar 2, 2007
I can't seem to load a movie clip, and then pass some variables from that loaded movie clip back to through stage_mc it is loading into - to the SubClip.
The structure is as follows:
Main
>SubClip
>>Stage_mc
Where the new movie clip is loading into stage.
I need to pass two variables from the loaded clip into the SubClip. Simple vars to fill some dynamic text in SubClip.
I've done the whole _root.myvar thing, _parent, and _global.
View 5 Replies
Nov 13, 2007
I'm having some issues referencing variables in the main movie.On the 1st frame of the main movie I have: var testvar="testing123";On the main movie I have a movieclip with an onRelease event handler that is defined with:loadMovie("Slideshow.swf",1);Slidwshow.swf contains:trace("From the main movie: " + _parent.testvar);however the trace statement prints "undefined" instead of "testing123"
View 7 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
Jul 7, 2010
how to pass variables from one Movie clip's AS file to my Main AS file. Let say my Movieclip's AS file is calling damage = 1; so how the Main AS file retrieve the damage value from the Movieclip's AS?
Code:
public class robotMC extends MovieClip
{
public function robotMC()
{
[code]....
View 5 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
Apr 20, 2009
I have a child class that is loaded into the parent class when the swf begins, like so: var myvar = 'hello'; public function Parent() { this.child = new Child(); }; How can I retrieve the variable 'myvar' from within child?
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
Feb 16, 2011
I have a main package that adds the background image to the project, from here on im trying to have seperate classes that add objects to the background as a parent and control these objects.my code in the main package:
package
{
import Dinos_Control;
[code]....
View 3 Replies
Mar 8, 2010
I'm trying to access the AchievementScreen's textfield from a medal object. Point being to have a mouseover event of the medal, change the content of the textfield shown. I tried a trace first: trace(this.parent.parent.parent.parent.textLineCon tainer); 1119: Access of possibly undefined property textLineContainer through a reference with static type flash.displayisplayObjectContainer. trace(this.parent.parent.parent.parent) shows me it is a AchievementScreen object. textLineContainer is the instance name of the MC nesting the textfield (I actually drew the achievement screen then exported it to actionscript.
[Code]....
View 11 Replies
Jul 13, 2010
var some="someone" some main.swf. mc:MovieClip.mc in main.swf. Iam load a mainMenu.swf file into mc. how can call some variable in mainmenu.
View 1 Replies
Feb 8, 2010
I have loaded a movie clip into the "root" from the library using addChild. Inside this loaded movieclip, I need to populate a variable, but this variable is in the main time. The value must be sent when the user click on the clip that has been loaded. I have tried the following using a mouse click event listener.
MovieClip(this.parent).currentScore = 20;
but it won't work.
View 6 Replies
Jun 17, 2009
I have a loaded SWF into a simple "holder" empty movieclip I have on the root stage. Inside that SWF I have two variables that have "stage.stage Height" and "stage.stageWidth" in them. If I leave them on the code and test the root movie I get this error: TypeError: Error #1009: Cannot access a property or method of a null object reference.So basically I can't seem to get the variables to get the parent stage. Anyway to get around that?
View 2 Replies
Jul 15, 2011
Scenario: in MAIN file, i have a door, when door is open, we can see activities behind the door - LOADED SWF - when the door is shut i would like all the activities behind the door - LOADED SWF to stop
Problem: my first attempt was to REMOVECHILD when the door closed, however, still functions in child=loaded file are continuing Possible Solutions i had in mind: I assumed if PARENT, dispatches an event and CHILD listens, i can say, if the door is closed, dispatch event to the child to stop functions. but it doesnt work, because i assume i dont know how to listen for an event dispatched from parent
[Code]...
I am also open to any alternative solution that helps me shut off the activities when the door closes down, dispatching event was the first thought that came to my mind, not necessarily the only answer i m looking for.
View 1 Replies
Apr 1, 2004
I can't figure out why this text file won't load when its parent swf is being called into the main swf but will separately. in an actions layer on the main timeline I'm using this code: _root.contents.loadMovie("easter_scroll.swf"); I'm calling the easter_scroll.swf, which calls Easter.txt, into index_main.swf but the text file doesn't load although the easter_scroll.swf loads. I am confident one of you flash gurus can figure this out.
View 1 Replies
Sep 10, 2009
I am trying to create a game in Flash. There are 43 spaces of irregular shape in the game and I already know the X and Y location. I defined them as a class which extends movie clip, I put them on the main timeline to start and I gave them all an instance name. I want to initialize them when I am starting a new game. I defined methods to set and get the properties, those methods work when I use the instance name, but many of the spaces share the same properties. The instance names are all I+some numberm I1, I2, I3. When I try to use a variable name such as space_Id = ("I" + i) to reference the instance name I get an error "Call to a possibly of undefined method. I tried the old actionscript 2 solution of putting an eval function eval (space_id) in front of the method but that didn't work either. It resulted in the same error plus a warning. I1.My_Method (); // works but it would require 20 or so blocks of almost identical code
var space_Id:String = "I1";
space_Id.My_Method (); // doesn't work
_root.space_Id.My_Method (); doesn't work
[code]....
View 7 Replies
Sep 6, 2010
What's the strategy for getting a child to access variables in a parent.I have a Main class.In that class I create instances of a Unit class and save those to an array.In the Unit class, I want to access the x and y coordinates of other instances of the Unit class.So I'd like to access that array I made in the Main class.I tried:this.parent.theArray[i].xbut that doesn't work. I tried using the get command, but I don't really know how to, so my efforts failed.
View 3 Replies
Oct 14, 2011
I'm trying to access some variables from my parent in my child MC.
Parent code:
var data_history:String;
function finish_checkUp(event:Event):void{
var checkUp_stat:String;
[Code]....
Now as you can see, i have tried the trace method, but with no luck. Flash doesn't report any errors regarding the trace method, but does report the two undefined vars (data_history). Ive tried to use the trace method above all the functions, at the top of the script, still the same errors though.
View 2 Replies
Feb 11, 2010
Look at this example [code]...
How come the trace in the SlotsSetup function is printing out NaN ?
View 1 Replies
May 4, 2010
I have TestA.as the base class file for my TestA.fla that has nothing but a movie clip with instance name box.
TestA.as
ActionScript Code:
package
{
import flash.events.MouseEvent;
import flash.display.MovieClip;
[Code].....
View 0 Replies
Nov 22, 2010
I have a movieclip walls and a movieclip character (both on the same timeline). I want to access and change a variable inside character from the walls timeline.
ActionScript Code:
MovieClip(parent).character.somevariable = true;
...not working.
View 2 Replies
Feb 11, 2011
Wondering how to do this:
Parent swf has a class loaded, lets call it 'GlobalUtilities'. Parent swf loads in child swf. Child swf wants to use some of the 'GlobalUtilities' class that is in the parent.
How can I accomplish this? The problem I'm having right now is, when I export the child swf, I'll just error out since it can't find the reference (obviously, since it's not loaded into the parent yet).
View 3 Replies
Mar 8, 2012
im working with my main FLA and a script for it child.as i have created a variable in the parent, "svar:Number = 0;" i would like the child to be able to modify this variable when certain triggers are met i've tried something like this in the "child.as" but im assuming its probably much more complicated
[Code]...
im wondering if there is a simple command such as this to call upon an existing variable in the parent? if not, is there a way i can import the variables using the import command?
View 9 Replies