ActionScript 3.0 :: Very Simple String In Variable?

Jan 27, 2012

I have a extremely simple problem here but my mind is not working at all today. I have the following code:

ActionScript Code: var myMessage:String = "Copy the notes "; on the main scene, but i want to change the text in the string when it loads a different frame or scene. I generated a new scene and in the first actionscript layer i used:

ActionScript Code:
myMessage = "Scene 2 loaded"
but it doesnt work.

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Simple Coding - Adding Variable To A String?

May 8, 2011

I can't figure out what the syntax is for this in Actionscript. Basically, I have a variable I want to add into a string that will call a certain frame based on user's language selection.

[Code]...

View 5 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 3.0 :: Simple Pad String Function?

May 29, 2011

I thought I would share a simple pad string function I created briefly... I know that there may be other similar functions already out there but I decided to make it anyway. It's basically a ripped off as3 version of the str_pad() php function.

Examples:
trace(stringUtils.stringPadLeft('7',4,'0','left')) ; // Traces 0007
trace(utils.stringPadLeft('whatever',2,'~','left') ); // Traces whatever
trace(utils.stringPadLeft('hi',20,'-','left')); //Trace ------------------hi

[code]....

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

Flash :: Display Simple Html String With <img> <p> Tag In Builder 4?

Jan 12, 2011

Display simple html string with <img> <p> tag in builder 4?

View 1 Replies

ActionScript 3.0 :: Break Down A Multidimensional Array Into A Simple String?

Mar 5, 2009

I currently use some code to break down a multidimensional array into a simple string like this:

Code:
var mapStr:String;
for ( var i:int=0; i < outArr.length; i++ ) {
for ( var j:int=0; j < outArr[i].length; j++ ) {

[Code]....

I want to be able to reconstruct the array from the string output from that.

View 1 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 :: Way To Pass Simple Variable

Dec 26, 2011

I am trying to use a simple variable, but it won't work[code]...

View 2 Replies

ActionScript 3.0 :: Passing A Simple Variable From Html?

Jan 23, 2010

I use an swf file to play short flv files on a web page. I write the embed/object tags into a dynamic web page using php and understand how to pass the relevent parameters to the swf file. As a complete flash scripting dummy, I don't know how to get the variable into the flash script or how to use it once it is there. At the moment I create a new swf file for each movie I want to display and write the file name into the script as below. how to get the file name into the script below using FlashVars or a query string in the html.

// Create a NetConnection object
var netConn:NetConnection = new NetConnection();
// Create a local streaming connection

[code].....

View 3 Replies

ActionScript 3.0 :: Simple Text Field Displaying Variable ?

Jun 7, 2009

in a simple AS2 .fla there was a text field labeled "message_number" which would display the variable "message_number."  Very straightforward.How can a text field in AS3 be made to display this variable?

View 7 Replies

AS3 :: Flash - Simulate AS2 _global Variable Using A Simple Class?

Feb 14, 2011

I have recently started making (and am still making) the transition from ActionScript 2 to 3. I have used the _global variable in an AS2 project as I needed a variable to be accessible from within ANY swf loaded into my main movie. This worked like a treat.

However, along came AS3 and whipped that from right under my feet. After much Googling, a few people suggested making use of a simple class with a simple variable that can be publicly set and retrieved. I made a simple class, imported it and manipulated the value, and all went well, however the instance of the class I create in my main loader movie is still not accessible from within a second SWF that gets loaded into my movie. If I re-instantiate the class in the SWF that is being dynamically loaded, the value reverts to the default value in the class code, not the new value set in my parent (first) movie.

Here is my class code, stored in an external .as file, is there any way I can simulate the ostype variable being a global variable?

package{
public class ostype {
public var ismac:Boolean = false;

[code]....

it's used as a simple identifier as to what operating system this flash app is being used on (mac or windows) and as a result let's me server content - such as saving files - in a different manner.

View 1 Replies

ActionScript 2.0 :: Simple Function - Menu Will Move Right Across The Screen If The Variable Is True?

Jun 25, 2005

just wondering why this isn't working :

Code:
var nav:Boolean = true;
var element:String = "home"; [code]....

Its so that a menu will move right across the screen if the variable is true, and if its false, it'll move left back to its original position.... i achieved this using a motion tween and telling the mc to go to the frame and play, but that didn't work in the end because if the menu bar was on the left side, and it was told to move to the left, then it would disappear,and appear on the other side.... so in other words it screwed up

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







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