ActionScript 2.0 :: [F8] Setting Variables From External Txt?
Feb 20, 2009
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.
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 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];
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 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 now working on a project using action script 3 now what i'm trying to make is a Main SWF that load whatever other swf into it the tricky thing is that i used 1 xml document read the external swf source nad it's setting(such as it's x,y position and it's width and height) and i'm having problem setting it's width and height (i mean the loaded swf width and height)[code]
In my timeline I have different link hot spots, so that each product will link to a separate web page (externally).I don't think this is going to work:When I upload the Flash file to a server to test, the links show me the 'pointing finger' icon, but when clicked upon it does not even open another web page attempting to follow the link. - that tells me this doesn't work!I need to get this correct for when the final goes live. What am I missing? Should I try the extension? (product01.asp)
i'll be straight to point,well i'm now working on a project using action script 3 now what i'm trying to make is a Main SWF that load whatever other swf into it the tricky thing is that i used 1 xml document read the external swf source and it's setting(such as it's x,y position and it's width and height) and i'm having problem setting the loaded swf width and height btw it's an desktop application and not a website application.,
I have a question about setting up an image array from an external source. I have the following action script and would like to edit it so that it reads from an external file. Either TXT or XML. how to edit the array action.