AS :: IDE - Pass A String To A Function And Use Its Value As The Variable Name

Mar 18, 2009

Is there any way that you can pass a string to a function and use its value as the variable name you wish to change. For example.

[Code]...

View 1 Replies


Similar Posts:


IDE :: Pass A String To A Function And Use Its Value As The Variable Name?

Dec 21, 2009

Is there any way that you can pass a string to a function and use its value as the variable name you wish to change. For example.

Code:
var text:String = "Goodbye World";
function myfunction ( varToChange)
{
varToChange = "Hello World";
}
myfunction("text")

View 2 Replies

ActionScript 2.0 :: Pass String To Variable

Mar 12, 2006

I'm creating a webpage where all the content is within the same swf. In order to get things to work I have all my different content in different MC's. Each of those separate MC's have two frames inside. One where it's empty and the other where the content is displayed. To make this work I have a variable name 'page'. My menu is supposed to pass a string to this variable and at the same time trigger a transition to be played ('doors' sliding over and hiding the stage).

Then the transition sets all my content MC's to the hide position. Then it checks what the page variable is and sets the corresponding content MC to show before the 'doors' open again. At least that's how it's supposed to work in theory. But I haven't figured out how to do all this. First off I don't know how to get my menu to pass that string to the 'page' variable. Here's my menu with the problem area marked:

[Code]...

View 6 Replies

ActionScript 3.0 :: Pass A String Variable To A SWF So That Can Specify A XML File To Load

Jun 14, 2010

I want to pass a string variable to a SWF so that I can specify a XML file to load without republishing the SWF. When I assign the string variable to a textfield it is correct.But when I use that variable in the loader it does not display the XML from that file.You can see below that I commented out the string "lesson_11/images/0301_objectives.xml".If I put this string in the loader it works, if I use the string variable in its place it does not work.

Code:
var xmlFileToLoad:String;
var myQueryString:Object;

[code].....

View 1 Replies

ActionScript 3.0 :: Pass A String As Function?

Oct 7, 2010

How to display the correct digits. For instance, if the answer is 97%, I want the display to show 97, not 11. Please feel free to view the SWF or look at the FLA file to see[code]...

View 5 Replies

Actionscript 2 :: Function's Local Variable Through A Concatenated Variable String?

Mar 7, 2012

how you would target a function's local variable through a concatenated variable string.For example:

var txt = "Hello World";
function testing(msg) {
var test1 = msg;[code].........

I'd expect the trace to be "Hello World" but rather is given "undefined". So if variables created outside functions are created on the main timeline, where are local function variables created and how would you access them?

View 2 Replies

ActionScript 2.0 :: Make A Dynamic Function ,pass A String Var For The Name Of Any Nested MovieClip?

Mar 2, 2007

why wont this work?

some_mc["nested_mc_name"].onPress = function():Void {
trace ("test")
};

I'm trying to make a dynamic function so I can pass a string var for the name of any nested movieClip I want on the fly.

View 1 Replies

CS3 : Pass A Variable Calculated In A Function

May 8, 2009

how I can pass a variable calculated in a function, to the stage.

View 9 Replies

ActionScript 2.0 :: Pass A Variable From One Swf To A Function On Another Swf?

Nov 8, 2005

I was just wondering if it's possible to pass a variable from one swf to a function on another swf?

I have 2 containers on my main stage, each one loads an external swf, I want one to send a variable to a function in the other container.

I simply tried calling the function by doing _root.container2.fncTest("works"); just to see if it works

and in container2 I have

Code:
function fncTest(test):Void {
myText = test; //dynamic text box on the stage
}

but that didn't seem to work.. Do I have to make the function public or that only works for classes?

View 13 Replies

ActionScript 3.0 :: Pass A External Variable To A Function?

Aug 6, 2010

I have an external log file which name changes each session, with the format XXXXX.log

I need to load it inside a swf to show its data, but each time the logs name is different, I need to open the .fla, changing the name of the file and then republishing the swf.

So I have made a simple script to load another .txt, to type manually in it the 5 number of the logs name and load it externally inside the swf:

Code:
var logNumLoader:URLLoader = new URLLoader();
logNumLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
logNumLoader.addEventListener(Event.COMPLETE, loadedLogNum);

[Code]....

While I cannot assign the value of logNum to the last function, the .log cannot be opened.

View 2 Replies

AS :: Flash - Pass Easing Function As Variable?

May 31, 2010

Is is possible to pass easing function as variable in AS3?g.

TweenLite.to(mcDelimiter, resizeTween, { x:(stageWidthHalf-(initStageWidthHalf-mcDelimiteri_X)), ease:Elastic.easeOut } );
TweenLite.to(mcBody, resizeTween, { x:(stageWidthHalf-(initStageWidthHalf-mcBody_X)),

[code].....

View 2 Replies

Flash :: AS3 - Pass External Variable To A Function

Aug 4, 2010

I have an external log file which name changes each session, with the format XXXXX.log I need to load it inside a swf to show its data, but each time the log's name is different, I need to open the .fla, changing the name of the file and then republishing the swf. So I have made a simple script to load another .txt, to type manually in it the 5 number of the logs name and load it externally inside the swf:

[Code]...

View 2 Replies

ActionScript 3.0 :: Pass A Null Variable Through A Function?

Jul 25, 2009

Is there a way to pass a null variable through a function? For example:

[Code]....

View 1 Replies

ActionScript 3.0 :: Pass Function Variable Into Tween?

Aug 5, 2009

How do I pass a variable into a Tween, lets say youve got a Tween like this[code]...

View 7 Replies

ActionScript 3.0 :: Pass Variable To EventListener Function?

Nov 19, 2009

I have a number of nodes that are plotted on stage. I want to display the value of each node when hovering over the node (using the Tooltip class). [code]...

View 4 Replies

ActionScript 3.0 :: Pass Variable Back From Function?

Aug 30, 2010

I am trying to get the score variable back but it says function is not passing back variable. Here is my code.

Code:

var score:Number;
function btnCheck(myevent:MouseEvent):Number {
if (input_txt.text == myTypeCheck) {
gotoAndStop(forwardFrame);

[Code].....

View 4 Replies

ActionScript 3.0 :: Pass A Variable To Timer Function?

Oct 5, 2011

Is there a way to pass a variable to the timer function effectively changing the length of the timer when it runs.[code]...

View 2 Replies

ActionScript 2.0 :: Pass Instance Name To Function As A Variable?

Apr 24, 2006

the idea is that the site keeps tracks of whatever page is current and passes this variable to the alpha function which will target that movie instance to fade when moving to another page - then that page's name will be assigned to current.this is the code that i have now..

#include "alpha.as"
evolution.onRelease = function() {
this[current].gotoAndPlay(2);

[code].....

View 5 Replies

ActionScript 3.0 :: Pass A Variable To Another Frame Or Function?

Oct 6, 2009

I'm trying to pass a variable to another frame but it's not working, can anyone please explain how to do this.

(I'm trying to build a video player--I have buttons for various videos on one frame and the player on another frame.)

View 4 Replies

ActionScript 3.0 :: Pass Variable To Function On AddEventListener?

Jan 15, 2011

So i have 4 buttons, that represent values: 10, 50, 100, 1000

When i click one of them i what a global variable declared: pulic var stake:int = 0; to e initialized with the value of the button pressed.

So i have the following code:

stake0050_btn.addEventListener(MouseEvent.CLICK, changeStake);

i would like to have a function changeStake, witch will update a variable called stake.

How can i tell the event listened to call changeStake with an argument?

View 5 Replies

ActionScript 3.0 :: Pass A Variable To A Function From An Event Listener?

Aug 29, 2008

How do i pass a variable to a function from an event listener which is inside a function Below is a function that is called when after loading some variables

function dataOK(mydataevent:Event):void{
var j:int = 0;
do {
trace(j);

[Code]....

This is a simplified version of the original code. The above function generates an error because j is undefined in the function. I am wanting to get the variable j when the button is pressed.

How do I pass the variable j to the Button_Click function?

View 1 Replies

Actionscript 3 :: Pass A Variable Into An Event.COMPLETE Function?

Feb 6, 2011

I am running a loop to pull thumbs into a containing movieclip from an xml list. What I want to do is have the thumb's parent movieclip fade in after they are done loading, but I can't figure out how to reference the parent once it's loaded.My code(which currently doesn't work the way I want it):

var vsThumb:articleBox;
var currentarticleX:Number = 0;
var articleLinkURL:String;

[code].....

View 2 Replies

Flash :: Use MovieClip Target Name To Pass Variable To Function

Feb 22, 2012

How can I combine the following functions and still pass a different string to the buildUI(); function?

I have two functions that do the same thing only at the end they both call a function and pass a String value to the function. This string value is the only thing different.

Below is are my eventlisteners and functions as they are now:

female_start.addEventListener(MouseEvent.MOUSE_DOWN, startFemale);
male_start.addEventListener(MouseEvent.MOUSE_DOWN, startMale);
//FUNCTIONS THAT DO THE SAME THING AND BOTH CALL buildUI BUT PASS A DIFFERENT STRING.

[Code].....

View 1 Replies

ActionScript 2.0 :: Pass A Variable To Function When Calling It With Interval?

Jan 30, 2009

How do I pass a variable to function when calling it with interval.

This:

Code:
doFlip(1);
to something like this:

Code:
myInterval = setInterval(doFlip(1),2000);

View 2 Replies

ActionScript 2.0 :: Execute Predefined Function And Pass Variable

Feb 7, 2005

Code:
onEnterFrame = traceMe("test")
traceMe = function(param){
trace(param)}
If that won't work then would someone explain how you get something to execute a predefined function and pass a variable...

View 1 Replies

Actionscript 3 :: Creating Event Listeners That Call The Same Function And Pass A Variable

Feb 20, 2012

I COMPLETELY MESSED UP MY CODE AND DID NOT CHANGE THE MOVIECLIP NAMES WHEN COPING IT INTO STACKOVERFLOW. SO IT MADE NO SENSE.

I am wondering if there is a better way to accomplish the following as3:

//THREE EVENT LISTENERS
shoe_icon.addEventListener(MouseEvent.MOUSE_DOWN, shoeApp);
top_icon.addEventListener(MouseEvent.MOUSE_DOWN, topApp);

[Code].....

View 4 Replies

ActionScript 2.0 :: Pass URL String From External File To AS Variable (dynamic File Names)

Nov 17, 2004

I have a movie player that works fine when i hard-code the url value in the video function, but when i try to pass that url/file path from an external file, the video doesn't load. I suspect that there is something i'm doing wrong with the quotes. What am i doing wrong?

[Code]...

View 5 Replies

ActionScript 3.0 :: Access The Value Of A Variable Of Which Only Have The Name As String In A Function

Dec 29, 2009

my goal is to keep my output window organized so i can follow all my traces more easily. so i wrote a couple of custom functions to achieve that. one of them would be: to more easily trace the following variable for example

[Code]....

View 6 Replies

ActionScript 3.0 :: Using String To Define Function And Variable (?)

Nov 16, 2011

I'm trying to make children of a tile and put them in their respective locations. To do that, I need to know what kind of tile is to be created, but if I just use my old method:[code]I will have to use a chunk of code like this for every single imaginable tile. Obviously, that is not efficient! So I'm trying to optimize it by having what tile type is to be posted saved in a string, then using the string to refer to what child is to be created, something like below:[code]how to make the above code work. Surely, there is a way to do this?

View 14 Replies

ActionScript 3.0 :: Call Function, Pass Value, Access Variable In Movieclip Class From Main Stage?

Nov 20, 2008

I have a movieClip named MC, and it's enabled with action script, with the class name MC_Rectangle and a Stage.I override the MC_Rectangle class file in a mc_rectangle.as external file.here is the code:

package{
import flash.display.*;
import flash.events.*;[ code].....

I have new a object in the main stage var

mc_rect:MC_Rectangle = new MC_Rectangle()

in main stage:

1. how can i access the variable "sequence" in "mc_rect"

2. how can i pass parametre from main stage to mc_rect via function setSequence(data:int)?

3. how can i call the function in addSequence() in mc_rect.

in asp.net, i usually use mc_rect.sequenct,mc_rect.setSequence(data), mc_rect.addSequence() to achieve my goals......btw, can function in mc_rect return out result to main stage?

View 1 Replies







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