ActionScript 2.0 :: Using Set And Eval Functions Setting Variables?

May 12, 2006

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];

[code].....

View 1 Replies


Similar Posts:


ActionScript 2.0 :: EVAL To Apply Text Variables?

Jul 19, 2003

I have a clip containing 8 MCs, named id1, id2 etc, each of which contain a dynamic text field with the variable thisNo. I want to run a loop that inserts each digit from a randomly generated number into each of these MCsPatID is the random number, IDLength is it's character length.

for (i=1; i<(IDLength+1); i++) {
thisNo = PatID.substr(-i,1);
eval("id"+i).iconNo = thisNo;

[code].....

View 6 Replies

ActionScript 2.0 :: Looping Non-array Variables With Eval()

Sep 3, 2003

I want to do a for loop that grabs values from different variables. This function works nicely without the eval() statement (using the commented line below it) but not with it.

function saveData ()
{
saveUrl = "savedata.php?";
for (count=1; count<=numberOfVariables; count++)

[Code].....

View 14 Replies

ActionScript 1/2 :: Eval Or Array Push - Storing Variables And Displaying It?

Mar 9, 2011

I have a variable call php_variable that loads from the php. It echos all the necessary variables. I have 2 array, Tel_start and Tel_area. The messages.text is just a text field I use to test if things are loading properly.

[Code]...

It display the correct string. But when I use Tel_start[0] like above, I got undefined. So here, the actual quesetion, what's the proper way of storing those variables and displaying it?

View 9 Replies

ActionScript 2.0 :: Setting Up Functions To Go With An Array?

Sep 7, 2009

I have an array that I have set up that would go with a series of movie clips, and I am trying to combine them with functions that upload xml pictures--firstImage(), secondImage(), and so forth.

Here is the array that I have:

Code:
var currentButtonId:Number = 0;
var buttons:Array = [btn1, btn2, btn3, btn4, btn5, btn6];
function buttonRelease() {

[Code]....

It enables and disables the movieclips depending on which one is clicked. But I want to make the xml functions (firstImage(), secondImage()...) go with the buttons in sequence. So once btn1 gets pressed the firstImage() xml function gets called.

View 1 Replies

ActionScript 2.0 :: Setting Up Functions To Work With An Array?

Sep 7, 2009

I have an array that I have set up that would go with a series of movie clips, and I am trying to combine them with functions that upload xml pictures--firstImage(), secondImage(), and so forth.Here is the array that I have:

ActionScript Code:
var currentButtonId:Number = 0;
var buttons:Array = [btn1, btn2, btn3, btn4, btn5, btn6];
function buttonRelease() {

[code]...

It enables and disables the movieclips depending on which one is clicked.

I want to make the xml functions (firstImage(),secondImage()...) go with the buttons in sequence. So once btn1 gets pressed the firstImage() xml function gets called.

View 0 Replies

ActionScript 2.0 :: [Flash8] Setting Callback Functions On An Object Methods?

Jan 12, 2006

Been doing some actionscript magic lately, done a nice interpolator class. The class, whenever an update occurs, calls a previously specified callback function. Normally, setting a variable of funCallback:Function and calling it works fine. However when I wanted to specify an *object's method* as the callback for the interpolator, it apparently called it as if it would be a static method.

And it isn't.What I need to do, simply speaking, is to be able to call an object's public method, having just th object's reference and function name, just like the second variant of setInterval does ( the one having "object, string" as the first two params, not "function").

View 12 Replies

ActionScript 2.0 :: (MX 04 Pro) Setting Variables For An Mc?

Dec 12, 2004

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

View 5 Replies

ActionScript 2.0 :: (MX 04 Pro) Setting Variables For A Mc?

Dec 12, 2004

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
}

View 5 Replies

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.

View 2 Replies

ActionScript 3.0 :: Setting Variables In A FOR Loop?

Apr 23, 2009

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?

View 7 Replies

ActionScript 3.0 :: Setting Variables In Different Classes?

Aug 13, 2009

I am trying to set the variable to classes in the loader like this

loaded_swf.content.classname.code = "AS3";

But that wont work for some reason?

View 1 Replies

Flash8 :: Setting Up Variables In Different Levels?

Dec 25, 2010

Actionscript Code:
if (Key.isDown(attack2Key)&&shot2reload == 0) { for (i=1; i<2+1; i++) { shot2++; shot2reload = 30 var newname =

[code].....

View 1 Replies

Actionscript 3 :: Setting Flash Variables Not From VB?

Oct 9, 2011

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.

View 2 Replies

ActionScript 3.0 :: Setting Variables To Parent?

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

ActionScript 2.0 :: Setting And Then Checking Against Variables?

Jun 14, 2005

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.

View 1 Replies

ActionScript 2.0 :: Setting Variables With Checkbox?

Dec 18, 2009

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).

View 2 Replies

AS3 :: CS3 - Calling Variables From Other Functions

Aug 20, 2009

If I have a function and I want to call a variable from another function (only 1variable), how do I do it? I know in the olden days you could set the variable to local or global, but that does not seem to work anymore. There is only 1 variable I need access to, but all the tutorials I have come across talk about making classes for multiple variables.

e.g. function2();
{
variable_b = variable_a;
}

[Code].....

View 3 Replies

Dynamic Variables In A Functions?

May 8, 2010

Why does this not work???

Code:
function myFunction(val0,val1,val2){
trace(this["val"+0);
trace(this["val"+1);
trace(this["val"+2);
}
myFunction("hello","test","hi")

All i get is undefined. If i just put "trace(val0)" i will get "Hello" -- so i cannot work out how to get the value of the dynamic variable inside hte function?

View 4 Replies

ActionScript 3.0 :: Variables Used In Functions

Mar 16, 2012

I got this variable:[code]is there a possibility that the compiler gets confused because my variable has the same name like the functions's parameter (type = type)? i'm not certain about this topic. Normally I'd write my function's parameter like this (if such a case occurs):[code]just to make sure the names do not exactly match.

View 3 Replies

ActionScript 2.0 :: Variables In Functions?

Nov 16, 2005

I can't figure this out.

Code:
function createTextBoxes() {
for (var n=0; n<caption_obj.textXML.length; n++){[code].....

The XML portion is working fine. What I'd like to be able to do is access the created text fields outside of the function. For example:

captions1.alphaTo(0,1,"linear",1);

This works fine when it's inside of the function, but outside of it, it won't. Basically I need to time the captions to things that are happening in an animation. The animations are also tween driven, so it would be something like obj_mc.tween("_x", 200,2,"linear", 5,fadeOutCaption1); with fadeOutCaption1 being a function that fades out the first caption and brings in the second. If there is a better/more effecient way of doing this let me know.I also can't seem to apply any styles to the text field. Do I need to create an array or object with ["captions"+n] and then pull from that?

View 2 Replies

ActionScript 3.0 :: Setting Variables For Timer Function

Jan 1, 2011

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.

View 1 Replies

Flex :: Setting Variables During Component Initialization

Oct 25, 2010

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.

View 2 Replies

ActionScript 3.0 :: Setting Multiple Variables Dynamically?

Nov 10, 2009

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;

[code]......

View 9 Replies

ActionScript 2.0 :: Setting Flash Variables From Javascript

Jul 7, 2004

Does anyone know the correct syntax for setting a variable on _root using Javascript?

The Macromedia site says:

<!-- javascript
movie.SetVariable("/:varname", "varvalue");

However, this notation is quite old. I haven't been able to get it to work.

View 1 Replies

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")

View 1 Replies

ActionScript 3.0 :: Setting Global Variables Within MovieClips

Dec 9, 2010

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.

View 2 Replies

ActionScript 2.0 :: Setting Flash Variables From Javascript?

Jul 7, 2004

Does anyone know the correct syntax for setting a variable on _root using Javascript? The Macromedia site says:

<!-- javascript
movie.SetVariable("/:varname", "varvalue");

However, this notation is quite old. I haven't been able to get it to work.

View 1 Replies

ActionScript 2.0 :: Setting Variables On Press And Release?

Oct 14, 2002

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.

View 6 Replies

ActionScript 3.0 :: Casting Variables Into Functions?

Feb 5, 2009

haven't wrote here for a while!This is what I'm trying to do:

var level:Number = 1;
var goat:* = "thisIsLevel" + (level + 1);
var camel:Function = goat;

[code].....

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved