ActionScript 2.0 :: Setting Variables In A Loaded Movie
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")
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
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 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.
I'm still a noob with flash. But I'm attempting to make my website using itSo far I haveseveral swf files that are all loaded into a "index" swf file.So all the code needs to work with that chain of MC's:_root.LoadedContent_mc.LoadedContent2_mc.Page1_mcThats the path to where I am working..Page1:I'm attempting to create a downloads list here. I have a phpfile already worked out that scans the directories "downloads" and "imgs", and generates a list of file names. It then formats each file name into a path to that file. And turns each path into a variable that can be loaded into flash.So basically after php does its thing we are left with this:
What i need is to set some values for a few movie clips and then use them all at once. Eg, i'll have 5 mcs in my movie, each with either variable = 1 or variable = 2 etc assigned to each of them differently. Then i want to run some code kinda like
if (the variable on mc_one < 4){ do some stuff }
Im not sure if im going about it the right way, but i think its fairly obvious what im trying to do
What i need is to set some values for a few movie clips and then use them all at once. Eg, i'll have 5 mcs in my movie, each with either variable = 1 or variable = 2 etc assigned to each of them differently. Then i want to run some code kinda like
I am trying to control some of the global variables in my script through an external text file.I have a variable called "_global.scrollOrNot", which determines whether I want flash to use the text window with a scroll-bar or the one without a scroll-bar. I am trying to control that through an external text-file called "ScrollCommand.txt". Here is my code:
the external txt states:
&sb1WindowScroll=yes frame1: _global.scrollOrNot;
[code]....
this is were I have a problem. It will always choose "MCtextFeldSB1noscroll". I have tested the whole thing with other variables, which were not changed by any LoadVars function and it works just fine then. As soon as I change the variable using the LoadVars function it will not work any more.
I used to dynamically set some variables using a FOR loop kinda like so PHP Code:
//Sorry, from memory var possibleValues:Array = ["red","green","blue","yellow"]; for (i=0;i<possibleValues._length;i++){ _root["colorNumber"+i] = possibleValues[i]; }
Second question, using that code in a function would set the variables at the root level making them available throughout the timeline. Without "_root" how do I get that variable available to everything?
I'm trying to pass flash variables to SWF file from my VB application.It worked in AS 2.0 using:SetVariable method of ShockwaveFlash object but it doesnt' work in AS 3.0.
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.
how I could somehow create an "if then" statement with variables for my website.
Basically I just want to have a button that checks for a certain variable when you click it (I want it to check if a movie, lets call it "movie1" is already loaded). If it comes back false, then movie1 and movie2 both get loaded.
This way, after movie1 is loaded for the first time, it wont be loaded again. Basically, movie1 is just my background for all my other movies. So clicking button1 for the first time would load movie1 and movie2. Clicking button2 AFTER button1 was clicked would only load movie3.
let's say 30. they are nothing less than colors of different shades/tints. firstly i need to randomize the loading of one of those movieclips when i push a button and secondly i want to control that randomization with a couple of check boxes. let's say i have a first row of checkboxes which control the particular color that is going to beoaded(red,green,yellow,blue) and a second row that controls the shade(extremely dark,very dark,dark,light dark,neutral,light bright,bright,very bright,extremely bright). for instance if i choose yellow and green from the first row of check boxes and neutral and light from the second row i want the movie to load randomly yellow and green movieclips with those particular shades(neutral and light).
I'm making an animation of calculating a projectile motion with air resistance based on Python code from [URL]. I include the relevant portions of codes as follow. I'm not familiar of the vector object in AS3 so I translate them into variables as follow:
Actionscript Code: //timer related variablesvar fps:uint = stage.frameRate;var interval:Number = 1/fps; var myTimerYes:Timer = new Timer(1000/fps); //air resistance timermyTimerYes.addEventListener(TimerEvent.TIMER, startSimYes); function startSimYes(e:TimerEvent):void{ [Code] .....
The timer activates when the user clicks the start button. The start buttons set the variables for the timer function. The variables are created at the start of the actionscript file. The code of the start button is:
Actionscript Code: start_btn.addEventListener(MouseEvent.CLICK, goTimer); function goTimer(e:MouseEvent):void{m = int(airText_mc.mass_txt.text); A = int(airText_mc.refA_txt.text); Cd = int(airText_mc.Cd_txt.text); rho = int(airText_mc.density_txt.text); [Code] .....
The result I get is the aX = 0 all the time, even after the update I specified in the timer codes. I can't understand what's wrong with the code, it's supposed to be updating every time the timer goes on.
I am loading a component which makes a HTTPService call to get data that will then be used to set certain variables in the component. I make the HTTPService call in an init() function (for the initialization event) and then set the variables according to the data received in the HTTPService result handler. However, the variables are still null at both the initialize stage and at the creationComplete stage. If I try and read the variables in a creationComp() function (for the creationComplete event), those variables are still null. Is this correct?
I guess I don't understand the flex initialization cycle very well. When are those variables actually set and available to be used? I need to manipulate those variables automatically after the component loads. Is there an event that comes after creationComplete that is appropriate or some other way to approach this? I am using Flex 3.
I've automated a lot of my script, but cannot automate the very beginning where one sets the variables. I have the following script that I'd like to put in a "for" loop :
private var aliPlane1:Plane3D; private var aliPlane2:Plane3D; private var aliPlane3:Plane3D;
I'm having problems in setting three variables using a for loop and then passing these variables to my function. I think it's something to do with the set function I'm using, because my colorFadeTo function claims it's being passed an undefined variable.
Code: for (var i=0; i<circles.length; i++) { var current = circles[i];
I'm working on a Flash game (AS3) and have come to a point where I need to change the value of a global boolean variable from within a movieclip. After searching all over I have yet to find a solution. Essentially, the problem is that I have a movieclip that contains a section of animation for my game. When this movieclip is told to begin its animation, it checks these global variables to see which of six animations to play. When it finishes any of these animations, I need to set the associated variable and increase the score.
I am trying to create a scrolling text section for a cd-rom I am creating.I have created buttons for the scroll up and scroll down and so far all I am able to get is a click click click to scroll up and down 1 line at a time.Would prefer to make a loop so when you hold down the button it "scrolls" until you release.Have had no luck in setting variables on press and release.
Right now, I have many MovieClips's in my array. I want to update all the alpha values of the MovieClips in my array. Right now, I am using a for loop but this is not the fastest way to do it.
Setting variables. Have a look at the file. Current height and width are both set at 200. I dont think i got the scripting right, or it may be in the wrong place.
Being a code purist, I always set Flash to demand that I declare all variables/functions with a type. Like this:var myVar1:int = 14; //Okvar myVar2 = 18; //Compiler ERRORMy problem is that I just reinstalled my computer (including Flash) but I've forgotten where I do this setting. Anyone here with a better memory than me?
I'm using this after my file has preloaded the swf: mcLoader.loadClip("sceneAll_1.swf", holder_mc);
what I want to do is set sceneAll_1.swf inside holder_mc to _x = -500 _y -250 to get it in the center of holder_mc than the default 0,0. I tried the usual technique with attachMovie but it didn't work for this.
I'm using Loader to load an external swf into my swf and adding that loaded swf to the stage using event.target.content.If i set the width and height of the loaded swf I actually resize the movieclip inside my loaded swf. What I wanna do is change the stage size of the loaded swf.