ActionScript 3.0 :: Accessing Variables In Main Flash Movie?
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
Similar Posts:
Jun 23, 2010
import com.hydrotik.queueloader.*;
.................
public class Main extends MovieClip
{
[code].....
I need to get access to loaded STRATTransitions.swf from the main movie and remove some text from it. There is no source code available for the swf.
View 1 Replies
Jun 13, 2009
Let us say we have a movieclip "mc1" on the stage. We also have another movieclip "mc2" inside mc1. We have declared a variable, say, var number1:Number=5 on the first frame of the main timeline. Now we go inside mc1 and then inside mc2 and write some code on its first frame. Is there any way to use the variable number1 over here? Can properties of mc1 be altered using the code written here? In AS2, it could be done using the "_parent" command, but it doesn't seem to work in AS3. (when we use parent and try accessing a property, it says that it is possibly undefined)
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
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
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
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
Apr 21, 2011
I have the following PHP file with a variable I am trying to access to place in a dynamic text box on my flash stage.
PHP code:
$returnVars = array();
$returnVars['username'] = "test";
$returnString = http_build_query($returnVars);
//send variables back to Flash
[code].....
The code was adapted from a tutorial using a class. However I do not get on with classes so wont be using any.
View 2 Replies
Feb 16, 2011
I have a MovieClip, that I'm going to add to the display list with my document class at runtime beacuase there will be many instances of it. The MoviClip "box" has 3 more MovieClip instances inside it,and each of those three have two more.It looks like this:
box
circle 0
oval0
oval1
[code]....
View 2 Replies
Sep 21, 2011
Okay so there are four variables on my timeline, two of which are arrays:
var greenSpriteArray:Array = new Array();
var pinkSpriteArray:Array = new Array();
var greenNum:int = 1;
var pinkNum:int = 1;
whenever I refer to them from a class file by just the variable names I get a 1120 undefined variable error. But if I call for example stage.pinkNum I get "1119: Access of possibly undefined property stage.pinkNum through a reference with static type flash.display:Stage."
View 1 Replies
Aug 16, 2010
I am hoping someone can explain about subclasses accessing variables from the super class. I found that the subclass can only access variables which are set in the constructor of the super class. Is there any way around this?
[Code]...
View 3 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
Feb 6, 2011
I have a little problem in my game. I have a var coins:int = 0; on frame one, and I want to access it from frame 2. I'm not using a document class. Is it possible to make some kind of a global variable like in as2 without having to put all my code from the main timelime to a document class?
View 1 Replies
Jul 15, 2011
I'm using flash CS 5.5 and AS 3.0 . I've a movieclip that contains 3 more moviclips that are acting as toggle buttons. I want to change frame number / label of main time line upon click of these buttons. With _root no longer available I dont know know how to do it.
View 2 Replies
May 8, 2009
I have multiple instances of a movieclip (a1) within the main timeline. These instances move around via tweening within the main timeline. The instances also appear (are added) and disappear (are removed) while the main timeline is playing.
Within the movieclip is this actionscript:
[Code].....
How can I access the main timeline from each instance (even when it is not currently on stage)? how I can keep all of my code within the movieclip?
View 2 Replies
Dec 2, 2010
How can I call a MC from a class other than my main. I am making a side scroller and I when the player hits certain parts of the level I want the floor to fall out from under him (think Mario). I created a new class to attach to the different MC of the floor but I cant figure out how to access the player MC from the class. The MC name is playerMC that was exported for actionscript, and the instance name is player_mc. This is the class.
[Code]....
View 1 Replies
Jan 26, 2008
I have multiple instances of a movieclip (a1) within the main timeline. These instances move around via tweening within the main timeline. The instances also appear (are added) and disappear (are removed) while the main timeline is playing. Within the movieclip is this actionscript:
(code)
addEventListener(Event.ENTER_FRAME, ef);
function ef(evt:Event):void
[code].....
View 2 Replies
Apr 26, 2009
I'm trying to make a flash website that has clickable buttons that will play different movie clips. But I dont know how to make it to just play the movie clip with the button you click without playing all the movie clips on the main timeline.
View 1 Replies
Apr 29, 2010
I'm definitely more designer than flash developer (as most of you might know. At least those that hang in the lounge or Arena). I need to know how to allow a loaded .swf file to control the main timeline in AS3.
I have a container .swf that includes global controls (jump menu/volume control) and branding. Loading a swf for the dialogue boxes (timeline animated ... although I realize there may be better ways to handle it). Another swf for a simcity-ish illustration that has animated elements with various states. I need all to be able to communicate with each other. I was able to load the movies no problem. Even communicate with the loaded ones from the main timeline. Just need to be able to go the other way.
View 2 Replies
Apr 7, 2011
From within a movie clip, I'm trying to update variables on my main timeline. I tried both _parent.variablename and _root.variablename, but neither worked.
View 4 Replies
Mar 11, 2009
I have a question about accessing functions or variables on the main timeline from a loaded swf. I know that there are a few ways to do this
1. Casting the timeline as a movie clip
Loader SWF Script
var testText:String = "Test";
var myLoader:Loader = new Loader();
loadData("loaded.swf");
function LoadData(aURL){
myLoader.load(new URLRequest(aURL));
addChild(myLoader);
}
2. Cast the timeline as a generic object
var parentObj:Object = this.parent as Object;
parentObj.unloadSWF("loaded.swf")
Why can you not just reference the main timeline of the container swf directly.
View 5 Replies
Sep 14, 2009
I have one .swf file inside a second .swf file. How do I have one .swf access variables from the second?
View 3 Replies
Jun 16, 2008
I have finally started with AS3 and flip-'eck its a different animal that AS2
I have a swf called login.swf and in it have declared the variables var total:uint=0; and loginState:Boolean=false
All my scripts for logging in sending/receiving variable from/to server scripts are all working!
So... when a user supplies a correct password another swf (userLogged.swf) is loaded (note: in AS3 this process is seriously different than in AS2) swf dont seem to be loaded 'into' another movieclip anymore... and this leads me to the puzzle!
How do I access variables declared in the project.swf, from within the userLogged.swf!
the old AS2 way = trace (_root.loginState);
or trace (_root.project.loginState)!
I am stumped by this new approach of AS3 of loading in other swf files. The _root. options is no longer available in AS3 (that much I've descovered, some tuts say use root. but I cannot get that to work)
trace (root.loginState)
or
var userLoggedIn=root.loginState
gives me the error
1119: Access of possibly undefined property loginStatus through a reference with static type flash.displayisplayObject.
when I try to publish the userLogged.swf
View 4 Replies
Dec 20, 2010
I have a class, the relevant parts of which are defined as follows:
class myClass extends MovieClip {
public function myfunc() {
trace( "mainVar: " + _root.mainVar );
}
}
As you can see, I want to access the variable "mainVar", which exists in the main movie, from within the class. This works fine, if I have only one instance of the class. But, if I have more than one instance, within separate movie clips, the value of mainVar is always taken from the first instance. How do I refer to the actual instance from within the class?
View 0 Replies
Jun 2, 2011
Here's my main class:
Code:
package
{
import flash.external.ExternalInterface;
[Code]....
Basically the class waits for the callback variable (my_msg). The problem is: I need to set the dynamic textbox text to my_msg variable.
How can I access it? I know I can access a public var in the timeline with functioname.variable but I can't define a public var inside a function, right?
View 4 Replies
Jun 3, 2009
I was trying to access some nested movieClips from the main time line but it was giving an error. What I have is a movieClip on the stage called "dog" and inside this movieClip I have two nested movieClips called "dogLH" and "dogRH". The movieClip "dog" was brought to the stage using actionscript 3.0 and when I tried to move the moveClips inside "dog" it gave me an error.
This is the code I have:
var dogog = new Dog();
dog.x =200;
dog.y =150;
[Code]....
What is strange is that if I add the movieClip "dog" to the stage manually and try the same thing it works. Any idea why it doesn't work when it is brought to stage with actionscript, but it works if I bring this manually?
View 2 Replies