ActionScript 2.0 :: [mx] String.substring To Variable?
Oct 17, 2003
Does anyone know how to use string.substring to get a letter out of a string and get info from a variable of the name of that letter.
like->
text1="Kartik"
for(i=0;i<text1.length;i++){
[code]....
View 3 Replies
Similar Posts:
Mar 4, 2011
I have a string variable assigned with some Content in HTML format.[code]...
But in the output i am getting as This is <b. Basically it considering HTML related tags also as text. But my code has to omit the HTML tags while calculating sub string.
View 2 Replies
May 1, 2010
for example, how do i know that the "hello world" string contains three letter l?
View 2 Replies
Apr 29, 2010
Given a string A, how can I determine if that string contains the substring "video/x-flv"?
View 5 Replies
Jun 11, 2011
how to replace all the instances of '(A)' in a string with just 'A'.
This is what I have, but it is not working:
String str = "(A) + (B) + ( (A) + (B) )";
str = str.replace("(A)","A");
View 1 Replies
Mar 9, 2011
Ok perhaps ive bitten off too much here...I know you are not supposed to parse xml/html to regex but the thing is there just arent many other options.Im using AS3.im parsing the source of textflowlayout text to a different format.
string to parse :
< fontFamily=Verdana encoding=unicode fontWeight="bold"> some text < fontFamily=Verdana encoding=unicode > some text < fontFamily=Arial encoding=unicode fontStyle="italic"> some text < fontFamily=Arial encoding=unicode fontWeight="bold" fontStyle="italic"> some text
what i really need is:
< fontname=Verdanabold encoding=unicode> some text < fontname=Verdana encoding=unicode > some text < fontname=Arialitalic encoding=unicode > some text < fontname=Arialbolditalic encoding=unicode > some text
logically i think of it as taking apart the string into substrings
checking if there are fontWeight or fontStyle in the substring
if there is then appending the font name with the weight or style so so that the font name becomes font NameWeightStyle.then rebuilding the string.The font could be any font with variouse styles or weights..so far:
pattern = /<(.*?)>/gixsm;
var matches:Object = pattern.exec(str);
var finalstring:String = "";[code]...........
View 1 Replies
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
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
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
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
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
May 18, 2011
I have a script that always returns iframe HTML back to flash. I was looking to get help on how to build some RegEx code to only find the URL. I would only like this substring so I can use it in another script.Here is the iframe code the I want to search for and return the substring:
HTML Code:
<iframe SCROLLING="no" id="myFr" style="width:660px; height:500px; border:0px; margin:0px; padding:0px; overflow:hidden" src="http://www.blabla.net/sdsdsd/?ut=wecsdsd&lang=EN"></iframe>
This is then best O could come up with but unfortunately.... it returns src=" too.
ActionScript Code:
private var _findTheURL:RegExp = /src=u0022(.*)u0022/i;
View 2 Replies
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
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
Feb 24, 2012
so im trying to figure out regular expressions in Flex, but cant for the life of me figure out how to do the following.From the sample below, i need to extract out only "Mike_Mercury".So i have to somehow strip out everything around it with RegExp, or whatever's best. Also, I would need it to work with other samples as well. Im getting this from the reddit api, so id have to extract that same section from a whole bunch of these.
<table>
<tr>
<td>[code].............
View 1 Replies
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
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
Jul 8, 2011
I am creating an searchbox for a tablet application. On entering any text the results appear below as a list. Now I want to change color of that part of the text that is there in searchbox.So which text control would allow me to do that. I found that RichText is one such control but Adobe recommends not to use it for mobileDevices.
View 1 Replies
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
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
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
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
Sep 9, 2009
Compare a string to a variable name. Is there anyway you can do that?[code]...
View 1 Replies
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
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
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
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
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
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
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