Convert Text To Variable Plus Quote Question
Help Help - Thanks
Ok. I have a series of variables:
quote1="fsafasfasfsafdsafdsafsfdsdfsad" quote2="sfsadfsdfsadfsadfsafsfdsafdsa" quote3="fsfsafsafdsafsafsfsafsaffssfsafdsaf" etc.
I have a line for a button that reads:
x=x+1; quote="quote"+x;
however what is displayed when I trace is "quote1" - how do I tell flash to read this as a variable and not as text?
Also how do I add quotation markes to dynamic text? quote=""this is my quote"";
doubling the quotes does work- is there a command that will maintain them?
Thanks for the help.
-Fleep
FlashKit > Flash Help > Flash ActionScript
Posted on: 12-27-2006, 09:22 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Dynamic Text Value Convert To A Variable
Hi People
I got an other problem. how can i handle the value of a Dynamic text that's coming for a cookie?? can I convert that in an otre variable??? How can I do it??
Hell pleas
Help With Dyanamic Text Random Quote Script
Here's the code I'm using, this action script is in the same frame as the dynamic text field:
newquote = random(numQuotes);
_root.myquote = eval("quote"+newquote+"txt");
It picks one and keeps picking one every couple secnonds. I want it to pick one and keep that one up. And when the swf is opened again, I want it to pick another and keep it up, not cycle through them.
This will be contained in another movie so just a stop action or a prev. frame won't do it. I need it in this code some how.
Thanks for any help.
joel
Convert String Variable Into Movieclip Variable?
I have a variable called something like city_str which has a value of "toronto". I also have a moveclip (exported for AS) called toronto_mc.
What I want is a way of concatenating strings of "toronto" and "_mc" and assigning it to a movieclip variable called toronto_mc. Everything I try gives me a mismatch error in the compiler. I'm writing AS2 using Flash CS3. Any ideas?
Convert String To Variable
Probably a real simple problem, but it is driving me nuts! I have a list of variables that serves as a script for a text-based game (line1, line2, etc.) I also have a number variable that grows by 1 with each line. But I can't figure out how to convert a string into a variable:
Code:
var line1:String = "This is the line.";
var currentLineNumber:Number = 1;
trace("line" + currentLineNumber);
This (as I'm sure you know) is returning "line1", instead of what I want, which is "This is the line."
Any suggestions? Thanks!
How Do I Convert A (String + Variable)'s Value To An Object?
I hope I can explain this correctly.
How do I convert a (String + variable)'s value to an object?
This is an abstract of the code below:
Code:
createTextField(String("tf"+i),i,"tf"+j._x + "tf"+j._width,0,50,17);
I have tried String(); so that I can convert the value to an object but I don't think String is correct here. I have also tried Boolean(); but to no avail.
Can anyone please help me with this. Your help is graetly appreciated. Thank you.
Code:
for (i=1;i<3;i++) {
if (i==1) {
createTextField("tf1",1,391,0,50,17);
tf1.autoSize = "left";
tf1.selectable=false;
tf1.text = t1;
tf1.setTextFormat(myformat);
} else {
j=i-1;
createTextField(String("tf"+i),i,"tf"+j._x + "tf"+j._width,0,50,17);
this["tf"+i].autoSize = "left";
this["tf"+i].selectable=false;
this["tf"+i].text = this["t"+i];
this["tf"+i].setTextFormat(myformat);
//trace(tf+i._x);
//trace(this["tf"+j]._x + this["tf"+j]._width);
}
}
Convert Xml Data To Number Variable :(
This is really doing my head in?
Could someone please let me know what I am missing.
scenario:
loading xml into flash...all good
retrieve a number from xml...all good
_root.number=my_xml.firstChild.childNodes[0].firstChild
display number we have retrieved...all good
trace(_root.number)//returns 3
add 2 to this number...all goes pear shaped
_root.number+=2
trace(_root.number)//returns "NaN"
I guess I have to convert the parsed xml value somehow but unable to find out how.
Any help greatly appreciated.
Kind thanks
Cylon
Convert Float Variable To Integer?
Can anyone help me convert a variable to a real number?
My variable is reduced to 75% here:
var clength = drop*0.75;
but it has decimals.
Any help would be greatly appreciated.
Thanks
b o s s a n o v a
Can't Convert An Imported Variable To A Number?
Hello, I'd use some help here as I'm about to go crazy, I've searched similar questions around the forum, and everyone seems to solve the problem the same way, while I try to do the same thing and it just won't work!
I'm importing some variables (only 1 actually, as I can't progress) from a .txt file.
I set up a textfield and it displays the content of the variable correctly (it's a number, but I guess it displays it as a string).
Then I use the function Number() to convert it to an integer, but it just won't work!
Here's the little code:
Code:
loadVariables("variables.txt",_root);
nummax = Number(max);
trace(max);
As I said, if I set up a textfield with the variable "max" it displays it correctly. But if I set another one with the variable "nummax" it will always display "NaN" (not a number). And the trace output for the "max" variable (the original one, string), is this weird thing:
Code:
<p align="left"></p>
Also, if I trace "nummax" it returns NaN obviously.
The content of the .txt:
Code:
&max=4
Doesn't change anything if I remove the initial "&".
That's all, I just don't know what to do. I've uploaded the little .fla.
Any help much appreciated.
Convert URLLoader Variable To A Number
Hi,
I want to use data loaded from a database to calculate the height of a movieclip.
I use this code to check the data
PHP Code:
trace("energy = "+ url_loader.data.energy); // outputs 4.55
trace(typeof url_loader.data.energy); // outputs string
Now when I try to convert this string to a number using
PHP Code:
var energy:Number = Number(url_loader.data.energy);
I get the following error: TypeError: Error #1009: Cannot access a property or method of a null object reference.
Hope someone can tell me how I can do this conversion. TIA.
Evaluating A Variable - Convert To String?
Hopefully someone can help here, it should be pretty simple. I have several buttons, when pressed they create a variable eg
buttonPressed=2;
This value is passed to the function eg
runFunction (buttonPressed)
All this is working fine. I then want to set the x and y coordinates using the number stored in the buttonPressed variable eg.
X=[button+"buttonPressed"]._x;
this doesn't work but I want the above statement to evaluate to
X=button2._x
I have also tried X=["button"+String(buttonPressed)]._x; but this isn't working either
Any suggestions??
How To Convert String Into A Variable Of LoadVar O
Hi guys!
I am recieving info from my data source, say myTextBox, myCombo & myRadio. i created the dynamic copies of these component & placed them on stage. In meantime, i also added their names to an array. what i wanna do is, when user clicks the submit button(which is always placed already there), then script should recieve values from my array, & send the info in them using a loadvars.
for example! i created instances of a textfield component( & called it myTf), an instance of combobox( & called it myCb) & a radio group( & called it myRd). While creating these instances, i also added their names to an array as:
myArr.push("myTf"); //& so on
what i wanna do is, when i press the submit button, then flash should go to the array, recieve the names of new components, then recieve the value from those components which my array indicates, then add the retrieved value & the name of that component in the load vars & send them to my server side script.
So far, i can recieve the name of instances from the array & can recieve the value from the respective components but i m unable to add the name of component & its corresponding value to my loadvar object.
say var myLv:LoadVars = new LoadVars();
myLv.mycomponentNameShouldGoHere = theValueOfComponent(the value part is easy but how can i dynamically add the name of an instance to the loadvar varable object.
Any suggesstions please!!!
How To Convert Input String To A Boolean Variable?
I'm not very good in English, but i hope someone out there can help me.
How do you get flash to read strings from a text box for example text1 = "2>7" and convert it to a boolean variable, where flash can compute if its false or true?
Your help is indeed appreciated
Thanks
How To Convert Input String To A Boolean Variable?
I'm not very good in English, but i hope someone out there can help me.
How do you get flash to read strings from a text box for example text1 = "2>7" and convert it to a boolean variable, where flash can compute if its false or true?
Your help is indeed appreciated
Thanks
How Can I Convert A String Variable To Be Interpreted As An Object?
I have a string variable called MenuUp. I put the name of movieclip instances into it. So, if I click on movieclip Menu1_mc, it rises up, and
I set MenuUp = evt.target.name. If I mouse over any OTHER menu label, I want to hide the open menu as I bring up the new menu (and set menuUp to the new menu). But I can't use evt.target.name to hide the old menu, because the NEW menu was the target. I don't want to have to use a big Switch statement. I want to hide whatever menu that menuUp is set to. But the following Tween doesn't work:
var HideIt:Tween = new Tween(menuUp, "y", Strong.easeIn, menuUp.y, navbar_mc.y, .4, true);
On compiling I get error 1119: Access of possibly undefined property through a reference with static type String.
This also failed:
var HideIt:Tween = new Tween(this[menuUp], "y", Strong.easeIn, this[menuUp].y, navbar_mc.y, .4, true);
This second one compiles okay, but gets "TypeError: Error #1010: A term is undefined and has no properties. at Portfolio_9_fla::MainTimeline/onOver()" when the statement tries to execute.
How can I convert the menuUp variable to be interpreted as an object in both occurrences of menuUp in the tween? More generally, any reference to documentation that tells how to converta datatype to be evaluated as another datatype would be appreciated.
I am new to AS 3.0, and would prefer to not delve into Classes unless I have to to make this work. Is there a function that will take a string and allow the tween to evaluate it as an object? (The documentation seems to indicate that the first variable in a Tween is an Object datatype.)
I've found some things that seemed close, but either didn't work or were too complicated for me to understand.
Any thoughts? Thanks a lot for the help!
How Would One Convert A Variable Of Type STRING To An OBJECT
Hi There,
I have an array of column names (ie strings) that i want to use to iterate through a dataProvider's label..
IOW
Code:
var columnList_ar:Array = new Array("jobID", "Customer", "Due_Date", "Status", "Quantity", "Media_Type", "Disc_Type", "Print_Colour", "Notes");
followed by...
Code:
for (var i:Number = 0; i < jobInfo_grd.dataProvider.length; i++){
for (var j:Number = 0; j < 9; j++){
trace (jobInfo_grd.dataProvider.getItemAt(0).columnList_ar[j]);
}
}
How do i convert the string called from the array, to a meaningful object that dataProvider command can understand?
Cheers,
joey!
How To Convert Variable Value Into Existing Class At Runtime
hi to all
i am using flash cs3. i have 5 images in flash library and i have converted them to buttons using 'convert to symbol' and then i import these buttons to as3 using linkage properties and use class name as Image1, Image2 and so on upto Image5.
now i need code to create instance of Image1 to Image5 class instances without using if else blocks..
like i have image with name img_1 which is instance of Image1 Button class and img_2 of Image2 and so on..
what i want is when i click on img_1 or any other then an instance of its own class is initited and new instance will display to desired location
i am using this code for MouseEvent.CLICK eventlistener of img_1, img_2 and so on but it doesnot work.
ActionScript Code:
var bg_img_arr:Array = new Array();
bg_img_arr = wallpaper_bg_image.split("_");
//wallpaper_bg_image is name of image like img_1, img_2 etc
var myClass:* = bgArr[bg_img_arr[1]-1] as Class;
//bgArr contains 5 name Image1, Image2 and so on
var img:myClass= new myClass();
img.width = wallpaper_logo_width;
img.height = wallpaper_logo_height;
img.x = (wallpaper_container.width - img.width)/2;
img.y = (wallpaper_container.height - img.height)/2;
wallpaper_container.addChild(img);
//wallpaper_container is the sprite in which new image displayed
This is the error
"1046: Type was not found or was not a compile-time constant: myClass. var img:myClass= new myClass();"
what can be the solution???
bundle of thanks in advance
regards
maani
Convert Variable's Value Into Variable
hi,
i like to know hoe to convert a value of a variable into variable.
for eg.
username="rajesh"
here, username is variable and rajesh is a value
now i want to create a new variable "rajesh" which has a value 23.
Please help me.
Raaj
Get RollOver Event On Pure Text Without Having To Convert Text Into Mc Or Bt?
Is there a way of acheiving mouse over (pure) text triggering action?
(Reason: externally loaded text can be made as links and trigger effects on the fly)
I've been through the macromedia actionscript dictionary, the addeventlistener function does not work for me (or maybe i'm just too stupid).
Please DO NOT suggest converting text to movie clip or button if you can't solve my problem. But if you do have an answer, many many thanks in advance.
Convert HTML Text To Normal Text
Basically I want to convert some html formatted text to normal text. I've got a html page being loaded into my swf but then I want to copy it to the user's clipboard, but as it is on screen without all of the html tags (<BR>, character escaping, etc). Previously i did it like this:
tempText.html = true;
tempText.htmlText = "<BR><B>hellow world</B><BR>";
copyText = tempText.text;
trace(copytext);
returns "undefined"
this code used to work but doesn't anymore :( I kind of want to refrain from using copy and replace string functions to get rid of the html formating because thats a bit unreliable given how i'm going to use this. So does anyone have any ideas? :D
How Can I Convert 'Text' To 'Fill'?
Please can someone tell me how to convert 'text' to a 'fill' so I can use it like any other shape. I see people using text as a filled shape or a mask but cannot figure out how to do it. I've been doin' Flash for a long time, so give it to me straight, I can handle it. Thanks!
Mitch
www.austinproject.net
Help With Text Space Convert To As2
Has anyone converted levitated text space to as2?
I'm really struggling with it. I'm not that experenced in as2 yet. Any help would be very great full!!
I want to convert it so I can use bitmap caching. I have over 450 text and it just crawls in as1.
Source code can be found here.
http://www.levitated.net/daily/levTextSpace.html
Thanks in advance!!
Code:
for (n=0;n<this.wordList.length;n++) {
// pick a word from the list
var word = Object.environment.wordList[n];
var x = random(600)-300;
var y = random(337)-169;
var z = random(Object.environment.fl*2)-Object.environment.fl;
// create an instance of the SpaceWord object
nombre = "word"+String(depth++);
var d = space.attachMovie("spaceWord", nombre, depth, {txtword: word, x: x, y: y, z: z});
}
Then in my class I have
Code:
dynamic class spaceWord extends MovieClip {
function spaceWord() {
this._x = x;
this._y = y;
this.z = z;
this.txtWord = word;
}
}
But this only places one movie clip on the stage....what am I doing wrong...sorry I now I'm a newbie @ classes and prob doing this all wrong!
Convert Text To Graphic
I have a fla document that has text buttons.....these buttons have a drop shadow effect added to them....if i try to publish the movie to work with flash 7, it takes away the drop shadow.
Is there any way around it taking that away? i was thinking of somehow converting the text+effect to a graphic.
can i do the conversion within flash?
Thanks!
How To Convert Dynamic Text Into Arc...?
Hi!
I am newbie to AS3 and Flash. Can someone guide me that how can I convert and display user inserted text into ARC shape, circular shape or wavy shape, etc through ActionScript3.
Thanks in advance
Convert Text To Number
Hi all,
I load some numbers from text file... the problem that flash is seeing these numbers as NaN and I want to make some calculations on them… how could I convert it to numbers… I try to write it as follows:
num1=parseInt( this.numtxt.text);
but it doesn’t work..
thanks in advance
Text Won't Really Convert To A Symbol
It seems like text doesn't quite convert into a symbol. It appears to convert when I'm in flash but when I run the file it won't perform any of the tweens and I can still highlight the text. Anyone know what I'm doing wrong? Thanks!
Convert Text To Graphic?
Hi all,
I am and have been a programmer for a while but am new to flash, so bear with the newbie question.
I can make graphics and get them to move, fade, scale, etc. but I cannot do it with text. i assume I have to convert or something but my tutorials dont address it or I don't get it ....I am sure it is an easy one.
Thanks in advance
Bassguy
Convert Text From Flash Into XML
Hi.I was wondering if anyone knew how i could type some information into a textarea in flash and when i press a save button it would be saved as an xml document.I know this might be difficult with the different tags that would need to be used but a basic structure could be used.Any help would be greatly appreciated.Thanks.
Quote Of The Day
Hi All,
I want to have a quote of the day (or something like that) on my websie. Does anyone have any suggestions as to how one would go about setting that up. So each day a different line of text was displayed.
Thanks for any help
Quote
How do you quote someone in this forum? I see people do it all the time and have no idea how.
kel
[F8] Quote A Day?
Hoping that someone can give me some pointers on how to do this.
I need to create a script to pull quotes from a text file - but the quote needs to be the same every month (i.e. the 1st of each month has x quote, the 2nd has y quote, etc.)
I'm assuming I pull the quotes from the text file as an array, and then pull "today's date - 1" (to fit with the array).
I can visualize it, but I can't write it. Anyone help?
Thanks,
Cat
Quote For A Job
Hi
I started a draft for a client, he likes the style and wants to go for it.
He's willing to pay for this first page that I've already made and asked me to invoice him for this one. How much would you think is a reasonable price ?
http://emunityrecords.com/4mula/soulstation/index.html
thanks
Quote
Hi
Is there anywhere on these forums where I can get a rough quote for a piece of flash work?
UK based people would be best if thats ok
Gavin
Very Urgent How To Convert Text As A Button
hi every one i created one website in that webstite i converted text to button but out put is showing blur text if i use alias and selectable for text it showing perpet but linke is not working could any one help plz
[F8] Can U Convert This Simple Text Box Ease Fla From F5 To F8?
Hi
http://www.elbowspin.com/Flash8EaseBox.fla
This is the source file for a simple text box with easing(inertia). It is a very simple application. However when I convert/publish to Flash 8 it stops working!!! Can anyone tell me why this happens? I am really curious to know the answer. Are there any syntax thingies I should be looking out for??
Honestly it is only a few lines of code please help me!!
How Do You Convert Text To Bitmap In Actionscript
I am doing an animation which includes some text floating around the stage. This however displays some unwanted effects. I believe i can convert my text to bitmap using actionscript but am not sure how to implement this. Is there anyone out there using a/s 3 who might be able to help me. Many Thanks.
Convert Input Text To Number
I need to convert the text in an input text box to a number so I can use it in my calculation. I've searched all over the forum and found codes of all sorts but I just couldn't get them to work. Can somebody help?
[F8] Easy Way To Convert Text To Actionscript
im working on a new game that will allow users to create their own levels and share via copy and paste.
when the map is create it presents the user with a few arrays for the level data.
Is there an easy way to just load the text with actionscript or would i have to parse everything?
Convert Text To A Graphic Or Bitmap
I have Arabic text in an swf which I want to convert to a graphic or bitmap (so that it's no longer recongised as text).
The text is used only as a background (for artistic purposes) but when it's viewed on some other computers it is displayed as normal Roman characters (I suppose if the Arabic script it not installed on that computer).
Any ideas how I can resolve this?
Convert Text To... And Then Back After... Interesting
Currently, I'm interested in making text convert to the ASCII Code Number, and then convert back. This is no problem, I've accomplished this in the code below, the trick would be to make the output letters vary by 3 letters, thus making the output with three letters later.
ex: "abc" would become "def"
Here's the code so far...
Code:
sampleString = "sample";
_root.newArr = []
for (i=0; i<sampleString.length; i++) {
_root["b"+i] = (sampleString.charAt(i));
trace(_root["b"+i]);
_root["c"+i] = ord(_root["b"+i]);
trace("converted to ASCII= "+_root["c"+i]);
newArr.push(chr(_root["c"+i]));
trace("Converted from ASCII= "+_root.newArr[i]);
}
a = newArr.join("-");
trace(a);
Help is always appreciated!
Convert Text String Into A Number - How
Bah i'm doing it wrong, is there any way to make flash convert my text string into a number, so it doesn't throw up the, text string unrelated to number error
Quote:
size_txt.restrict = "123456789"
size_txt.text = enteredText;
var enteredText:Number
Convert Text In Flash To Bitmap?
Forgive me but I have to ask. Is it able to convert text in flash to bitmaps? Or do you have to do it in photoshop before you import it in flash?
16 Bit Integer Convert To Chinese Text?
Hi, i have an external actionscript which i load an array with chinese characters into the program. Problem is the chinese characters are not displaying correctly. I thought if i use charcodeAt() to convert them to 16-integer in the array and load them in the flash file, it will be ok.. but flash don't have a function that converts 16bit integer to string or is there?
Can anyone help me? Thanks in advance.
Convert Object From Text File
Hello all:
I'm wondering if there is a way to convert a text setting that i have stored in an xml file into its corresponding object. For instance, I am loading various easing types such as Strong.easeOut as a setting in this xml file. However, xml converts everything to text and as such I cannot use this setting directly without using something such as eval (which is inefficient and not what I wish to resort to). So is there a way to get this setting to be recognized as a function, object, or whatever it may be? I know you can convert things like a number or boolean with their corresonding conversion functions -> Number(xmlNode.firstChild) but I know of nothing to get an object or function out of a string (if it is possilbe at all).
Thanks.
Random Quote
In my HTML site, I have JavaScript that displays a random quote each time someone loads the page. Can I do this is Flash. I know next to nothing about actionscripting, still trying to get into it.
|