ActionScript 3.0 :: Combine A Variable With A String?

Apr 15, 2011

Im trying to combine a string with varible so that on function can control a variaty of elements, depending on which varible is chosen. Here is my code:

[Code]...

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Combine Multiple Variable Names Together To Target New Variable?

Jan 31, 2012

I'm still learning flash and actionscript 3 and i am having trouble with variable and object names. I need to be able to combine variable names together (in the same way as php can combine by doing var1.var2).

My swf contains 4 loaders (image1_loader, image2_loader etc..) which are a child of (image1_content, image2_content etc.....)

I then have 4 buttons which load an image into the loader and while doing so they define the currently active loader.

Finally i have 4 control buttons - scale up/down and rotate clockwise/anticlockwise which should only control the currently active loader (as set by the buttons above)[code]...

View 2 Replies

Actionscript 3 :: Combine Multiple Variable Names Together To Target New Variable

Jan 31, 2012

I'm still learning flash and actionscript 3 and i am having trouble with variable and object names. I need to be able to combine variable names together (in the same way as php can combine by doing var1.var2).

My swf contains 4 loaders (image1_loader, image2_loader etc..) which are a child of (image1_content, image2_content etc.....)
I then have 4 buttons which load an image into the loader and while doing so they define the currently active loader.
Finally i have 4 control buttons - scale up/down and rotate clockwise/anticlockwise which should only control the currently active loader (as set by the buttons above)

So my buttons as well as loading the image have the event listener:

image1_btn.addEventListener(MouseEvent.CLICK, setCurrentSelection);
image2_btn.addEventListener(MouseEvent.CLICK, setCurrentSelection);
(and so on..)
function setCurrentSelection(e:MouseEvent):void {

[Code]...

So within the rotateClockwise and rotateAntiClockwise functions i need to be able to recognise which is the currently active loader and have that number instead of the X - so if it is image1_loader - it needs to be image1_content, if 4 - image4_content... I had tried to do it as this but it doesn't like it being a string:

rotateAroundCenter((activeLoader+'_content'), 10, ptR);

View 3 Replies

ActionScript 3.0 :: Combine Multiple Variable Names Together To Target New Variable

Jan 31, 2012

I'm still learning flash and actionscript 3 and i am having trouble with variable and object names. I need to be able to combine variable names together (in the same way as php can combine by doing var1.var2).My swf contains 4 loaders (image1_loader, image2_loader etc..) which are a child of (image1_content, image2_content etc.)I then have 4 buttons which load an image into the loader and while doing so they define the currently active loader.Finally i have 4 control buttons - scale up/down and rotate clockwise/anticlockwise which should only control the currently active loader (as set by the buttons above)So my buttons as well as loading the image have the event listener:[code]So within the rotateClockwise and rotate Anti Clockwise functions i need to be able to recognise which is the currently active loader and have that number instead of the X - so if it is image1_ loader - it needs to be image1_content, if 4 - image4_content.I had tried to do it as this but it doesn't like it being a string:[code]

View 3 Replies

ActionScript 3.0 :: Combine 2 Variable?

Jan 14, 2010

i need some data in my variable so i use this

Variable_name1 = Data1
Variable_name2 = Data2

but the datas are from database, so i need to change it depends on CurrentRecord

so when CurrentRecord is 1
Variable_name1 = Data1

View 5 Replies

ActionScript 3.0 :: Combine Instance Name With Variable?

Dec 29, 2009

I can't believe that I could not find an answer for this the last 2 hours...

I have dynamic text boxes called txtItem1, txtItem2 and txtItem3 on my stage.

How can I replace the - this["txtItem" + i]- method to dynamically name the text boxes in a loop (that I used all the time in as2), in as3.

View 9 Replies

ActionScript 2.0 :: Create A String Variable...and Then Use The Value Of That Variable To Declare Another Variable?

Jan 3, 2006

f you know PHP...then you know that you can create a string variable...and then use the value of that variable to declare another variable. like this:

PHP Code:

<?php$foo = "haha";$i{$foo} = "success";print $i{haha};?>

and it would display "success"...or like this:

PHP Code:

<?php$foo = "haha";$$foo = "success";print $haha;?>

and it would also display "success".

View 6 Replies

String :: Flex - Download A String Variable As A File To The Local Machine?

Sep 21, 2011

I have a String variable in my flex (flash builder 4) application containing CSV data. I need to allow the user to download this data to a local file. For example, giving them a "csv" button to click and it might present them with a save file dialog (and I would be sending the contents of my string variable).Is this possible / how ?I am using the ResuableFX component for the datagrid to csv. This the code I ended up with that works to save the string to a text file for the user (in a web browser):

var dg2CSV:DataGrid2CSV = new DataGrid2CSV();
dg2CSV.includeHeader=true;
dg2CSV.target=adgEncounters;

[code]......

View 1 Replies

ActionScript 2.0 :: String Variables - Consentrate A String To Call That Variable?

Mar 16, 2002

If i have an ASP page that is returning variables (and I can see them in the debugger) how do i consentrate a string to call that variable?

ie:
variables being returned are named:
"res1", "res2", "res3"...etc
for (var i = 0; i < 10; i++) {

[Code]...

View 4 Replies

Regex :: Replace Portion Of String With A Variable String?

Feb 10, 2012

Trying to replace a portion of a string with a "-" if it matches a string variable in AS3.

var re:RegExp = new RegExp(imageArray[j][1],"gi"); trace(imageArray[jTemp][2].replace(re,"-"));

imageArray[jTemp][2] is a string imageArray[j][1] is a string as well I'm not getting the result I expect. I would like trace above to return 'permanentContainer-' Here are the traces for the above variables

permanentContainer-temporaryContainer- temporaryContainer

View 2 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

As3.0 :: Append A String To A Variable So Flash Reads It As A Variable?

Sep 27, 2010

i'm getting a value from a class that gives me e.g "icon1" as data. i want to use this within a function to control the visibility of an item nested in a movieclip on the stage. the nested movie has the same name as the data being sent.

// here's what i want it to do:
mymenu.icon1.visible = true;
// but i cant append the 2 together as flash will see it as a string not read it as path.

[Code]....

View 1 Replies

ActionScript 3.0 :: Change String Variable To A MovieClip Variable?

Oct 10, 2008

I have been banging my head against a brick wall regarding the following problem which must be very simple to fix, just can't see the answer.I have a class assigned to a movieclip called canvas. The class is called drawClass. I have called the instance of canvas on the stage 'drawingCanvas'.When I trace "drawingCanvas" I get object drawClass] which is fine. Tracing drawingCanvas.name gets me the instance name 'drawingCanvas'.This is a String variable.Basically what I am trying to do is pass the MovieClip name to another class. In my example the class 'toolBar', which can then interact with the MovieClip.

The problem is passing 'drawingCanvas.name' results in a String, so I get an error saying :TypeError: Error #1034: Type Coercion failed: cannot convert "canvasArea" to flash.display.MovieClip.I can't for love or money find a way to convert a String variable to a MovieClip variable! I have the name of the MovieClip, I just need to tell the toolbar class. But I can't find a way of doing this as the instance on stage is an object of drawingClass, not a MovieClip (unless MovieClips with attached classes are not treated as standard MovieClips?).

View 9 Replies

ActionScript 3.0 :: String Variable In Place Of Int Variable?

Jan 2, 2012

This is sort of difficult to explain but I'll do my best. I've got 6 score variables that go up over time.

[Code]...

Each corresponds to a different color of "Monster" class I reated. "GreenMonster", "BlueMonster", etc. are all custom classes. Each class has a string property called "MonsterColor". So "Blue1.MonsterColor = "Blue".

To save lines of code, and learn, I'm trying to use a local string variable to take the place of whichever of these 6 int variables I need. So inside a for loop, I've created a variable called "colorscore".

[Code]...

View 5 Replies

ActionScript 2.0 :: Use A String Variable To Instantiate A Variable

Jun 11, 2002

I would like to dinamically create array variables, depending on a XML file. The problem I have is that I don't know how to create them dinamically using a name I have constructed into a string variable. What I would like is something like this:

var strVarName;
...
strVarName = "Var" + i;
var strVarName = new Array();
...

So I would have n arrays called Var1, Var2, ... Varn.

View 1 Replies

ActionScript 2.0 :: Variable Name To String?

Sep 11, 2009

Is it possible to convert a given variable name to a string?

Code:
function vartostring(mystring:String) {
//something like var newstring:String = parsevarname(mystring)

[code].....

View 3 Replies

String Variable With GotoAndPlay?

Apr 8, 2009

I am trying to go about a "smarter" way of setting up multi paged full flash sites. This has got to be something very simple that i can't seem to put my finger on.

I'm trying to create a variable called 'currentScen' that i can declare off the start and change depending on what page the viewer goes to in the site.

I could put a bunch of 'if' statements saying that 'if the current page is this page then do this, if it's this page do this' etc. for each individual page but i thought there must be an easier way.

I am trying to get the following to work:

Code:

// declaring what the starting page is
var currentScen:String = "welcomeMovie";
//function fading in called page with animation used on the 'over' frame label
function animateOn(page:String) {

[Code].....

View 1 Replies

ActionScript 3 :: How To Get Name Of Variable In String

Sep 23, 2010

Example:
public var myVar:Object;
// now I want to get the myVar string
// myVar is not instanced*
public var whatINeedIsThisVar:String = 'myVar';

View 1 Replies

ActionScript 3.0 :: Act On Change In String Variable

Apr 7, 2009

What is the best way to listen for and trigger a function when a string stored in a variable changes? I have a variable named source which is a string. When its value changes I need to run a function newVideo. What's the most efficient way to detect the string has changed?

View 3 Replies

ActionScript 3.0 :: Compare String To A Variable Name?

Sep 9, 2009

Compare a string to a variable name. Is there anyway you can do that?[code]...

View 1 Replies

ActionScript 2.0 :: CS3 Variable String / Boolean

Nov 9, 2009

having an issue with a variable set. It is set as a string to default "no" on the very first frame of my movie, as follows:

var myaccess:String;
myaccess="no";

Within my movie, there is an object. When this object is pressed, it is to change the _root.myaccess="yes"; I am tracing the variable within the movie clip and it shows me: I do not understand why it is changing my string definitition from "no" to false. Because of this, my variable does not seem to change to "yes' on object (button) pressed.

View 1 Replies

ActionScript 2.0 :: String Variable In If Statement

Jan 22, 2010

I have a movie clip on the main timeline that includes a button.When pressed, I want this button to conduct an if statement to check the contents of a textbox on the main timeline and if equal execute the statement.So far I have this but the text does not seem to 'read'. Do I need to pass the textbox contents into a string variable rather than read directly from what is in teh text?[code]

View 2 Replies

ActionScript 3.0 :: Converting A String In To A Variable

Jul 14, 2009

I have a string that stores an object's instance name: var instName:String = e.target.name; and now I need to use its information to do something like this: instName.alpha = 0.3; but since it is a string it causes this error: 1119: Access of possibly undefined property alpha through a reference with static type String.

View 1 Replies

ActionScript 3.0 :: Variable To String Mapping?

Oct 13, 2009

I'm new to flash and working to embed the flash player in a .NET application. It's going "well" for the definition of "well" that adding the COM control and getting it to play a movie was easy and took about 3 minutes.What's not going well is that I cannot find documentation on the variable to string mapping used the SetParameter variable parameter. To coordinate between the apps, I want to be able to say: "flashPlayer.SetVariable("flash_variable", "value_to_set"). Obviously SetVariable does this. What's not obvious is how "flash_variable" is constructed.
 
For example, in the actionscript for a button called "OneBigButton" I have the following code:
 
OneBigButton.addEventListener( MouseEvent.CLICK, onClick );var testSetValue = "value";function onClick(evt:MouseEvent):void {    trace("got the click " + testSetValue);    outputText.text = testSetValue;}
 
When I try this:
 
flashPlayer.SetVariable( "testSetValue", "foo" );
 
The results do not get set in testSetValue.
 
I'd love a pointer to the documentation on how namespaces, class instances, etc affect the string construction used in SetVariable and GetVariable as I can't find it anywhere.

View 3 Replies

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 3.0 :: Cast A String Into A Variable?

Apr 5, 2011

i have a list of items that get returned from a database.  the list is composed of strings. what i need to do is convert each item into a variable so that i can use each item as an array.
 
for instance, my array will look something like this: deviceArray = ["osx106", "osx107", "winxp", "win7"];
 
what i want to do is turn each item into its own array.  in AS2 (iirc) we had an eval() method.  that is no longer supported in AS3.

View 2 Replies

Php :: Adding Outputted String To Variable?

Apr 15, 2012

im using PHP with MySQL to send information to my flash file using GETs.Using FlashVars i have managed to get the users 'id' with this i can send my questions/searches to a PHP script which access the database and returns the information to the html page.What i would like to do now is add the information sent back to the html page to a variable inside flash for example:

var usr_name = get_user_name(id) || 'Unknown'; // "Unknown" should just be for offline use.

but this just returns 'Unknown' this is the function used:

public function get_user_name(usr_id){
loadData('search.php',"quest=name",'usr_id='+usr_id);
}[code]......

If i just type the URL into a web browser i get the name outputed.

View 2 Replies

Flex :: Get String Of Variable Name In ActionScript?

Jan 26, 2011

Does anyone know some ActionScript api to get String of a variable name like following:

var foo:int;
var variableName:String = getName(foo);
trace(variableName);

The console need to show "foo" as the result of trace(variableName);

View 2 Replies

Actionscript 3 :: Calling A Variable Given Its String Name

Nov 29, 2011

var myvar = "this is the value of myvar";
var notMyvar = "this is some other variable";
var thirdVar = "this is some third var";
var nameOfVarToCall = "myvar";
//print the content of the var name specified, in this case "myvar"

I have a string which contains the name of a variable I need. What I want to do is find out the name of var (in this case "myvar") and use the name to access the value of the var (in this case just print out the value). Is this feature available in Actionscript. I know it's available in PHP and can come in very handy.

View 2 Replies

ActionScript 3 :: How To Get String Representation Of Variable Name

Dec 8, 2011

Any way of doing this is as3? For example, if I have a var dog:String, how can I get "dog" out of that variable? Looking into reflection to do this, but there's got to be an easier way.

View 4 Replies







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