Pass A Sting To A Button
I use a textfield on my webpage and i want to pass the string of that textfield to a button.
example : I set in the textfield the words : click on this button so on the button should appear click on this button.
Can anyone help me ?
FlashKit > Flash Help > Flash Newbies
Posted on: 04-28-2003, 05:09 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Sting Values
name=_name;
trace(name);
myString=eval("name");
trace(myString);
suffix=myString.substr( myString.indexOf( "text", 0 ), myString.length );
trace(suffix);
Temp=myString.substr( 0, myString.indexOf( "text", 0 ) );
trace(Temp);
---------------------
the _name of the object is 'londontext'. The whole point of this excercise is to get the value city name out of the object name which is made up of the city name suffixed with the word 'text'.
i get the first two traces ouputted as 'londontext' so it seems that myString is starting with the correct value for the rest of the script. but then the rest of the code doesnt work. i get 'n' as the third output and nothing fo rthe forth.
but if i start the script myString="londontext", everything works as expected and the third and fourth outputs are 'text' and 'london' respectivelly.
what's missing?
[F8] Sting Replace Help
I have a dynamic text box that is populated by previous frames input boxes. The call to populate the dynamic box is vary large and contains more than just quoted text and variable names.
Everything works perfect, but I have an issue I want to remedy. If I leave an input box blank in the previous frames I get "undefined" in the dynamic text box.
I am using this string replace technique and it works well for what it does, but I need it to check the whole dynamic text box after being rendered for the "undefined" not a "string of text here" but instead a "dynamic.text"
I can't figure it out as nothing is working. Ideas?
~MoN
Converting A Sting To A Number
hey ppl, I have a var that contains a string and i need to convert it into a number but I dont know how example:
a = "5"
how do i make it a=5
I know how to convert a number into a string but how do i go the other way?
pls help
thx
SetMask + Sting = Error
Why doesn’t setMask accept a String variable to be masked.
This code works:
var sPic:String = "mcPic";
this.attachMovie("mask","mask",1,{_x:300, _y:200});
this.attachMovie(sPic,sPic,2,{_x:300, _y:200});
mcPic.setMask(mask);
This code dose NOT work:
var sPic:String = "mcPic";
this.attachMovie("mask","mask",1,{_x:300, _y:200});
this.attachMovie(sPic,sPic,2,{_x:300, _y:200});
sPic.setMask(mask);
I get the following Error:
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 4: There is no method with the name 'setMask'.
sPic.setMask(mask);
Total ActionScript Errors: 1 Reported Errors: 1
How To:value Of Sting Becoming An Array In A Variable
I am doing something completely wrong. When I trace the below I get the correct array name but what I want is the value of index 0. how do I get the below variable to spit out the value the array as its own value??
thanx
ActionScript Code:
var mainImage2:String = [currentWorkBtnPrefix + 'main_arr[0]'];
Converting A Sting To A Movieclip
I want to convert a sting which comprises of the instance and a suffix so I can edit show my addresses.
var addressName = event.target.name + "Address";
I tried this but is is null when I trace it.
myMap.aberdeenRed.addEventListener (MouseEvent.ROLL_OVER, showAddress);
function showAddress (event:MouseEvent) {
trace(event.target.name + "Address");
var addressName = event.target.name + "Address";
addressName.alpha = 0.2
}
Combining A Sting Var & A Number Var
I tried everything before i posted this questions...
How can I combine my counter number to the end of the string variable?
name1 = value
i=1
while (i<amount){
combovox.addItem(name + i);
i=i+1;
}
desired output value1
What am I doing wrong?
Eval A Sting Into An Array Reference
I have a data structure called siteContent (which is really a hash) and I want to be able to build a string and then eval the string to reference the array element.
For example let's say I wanted to access the element
siteContent['Link A']['Sub 1']
Then I would like to be able to do something like this:
my_reff = eval("siteContent['Link A']" + "['Sub 1']");
and have my_reff be the actual reference to the array element, not a string.
Does anyone know how I can do this?
Thanks!
-Sean
Sting Manipulation : Newbie Problem
hey all
I need help on this one..
i got a list of data.. looking like this...
xxxxxxxxBlablabla
xxxxxxxxYadadadaad
xxxxxxxxBluhbluhbluh
xxxxxxxxYapyapyap
if i want to remove the first 8 characters.. ( "xxxxxxxx" , in this case can be anything)..
how do i do it..? substr?
help apreciated
Creating A Query Sting In Flash Mx
this isn't working, any ideas on the correct syntax:
i have var in the flash
qq=3 and rr=6
I'm trying to use a getURL to pass these onto the proceding page, something like so:
getURL("0eure7ghi.asp?qq=+qq&rr=+rr"), "_self")
any ideas?
thanks
Sting To Number Conversion Issue
Why does the following code convert the string to 399?
var str:String = "0617";
var strNum:Number = Number(str);
trace("strNum: "+ strNum);
Thanks,
Jeff
Pass Button Instance Name To A Function When Button Is In ScrollPane?
I have a ScrollPane component which holds a movieclip from my library. I am trying to set up a funtion to read the movieclip.button instance name when I click a button. On a trace, all I receive is "spContentHolder."
How can I capture the button instance name when the button resides inside the scroll pane?
Thanks.
Problems With Splitting A Sting [ String.split ]
Im trying to split a large string into an array.
the problem is that flash "hangs" when i try to split a large string (>100 vars) It works (very slowly...but) properly if i use a small string (about 20 variables)
does anyone have the same problem (there MUST be whole communities that have faced this problem, not?)
i found this splitting code on the internet but its quite bulky does anyone know an other routine for splitting?
Thanx in advance!
code:
String.prototype.split = function(d){
if (d != null){
var r = new Array();
var size = this.length;
var c = 0;
var n = 0;
if (d != ""){
for (var i=0; i<=size; ++i){
if (substring(this, i+1, 1) == d){
r[n] = substring(this, c+1, i-c);
c = i+1;
++n;
}
}
if (c != i){
r[n] = substring(this, c+1, i-c);
}
}else{
for (var i=0; i<size; ++i){
r[i] = substring(this, i+1, 1);
}
}
}else{
r = new Array(this.toString());
}
return (r);
}
Pass A String To A Button
I use a textfield on my webpage and i want to pass the string of that textfield to a button.
example :
I set in the textfield the words : click on this button
so on the button should appear click on this button.
Can anyone help me ?
Use Button To Pass Var To Another Frame
Hi guys im back,
ok so i got a button on frame 110, and i got some code in the actions of frame 120.
I need it so that when you click the button on 110 if passes the var page = therightscene, to the action code in 120, ermm.... look
button code
----------------------------------------
on (release) {
play();
var page = corporate;
}
----------------------------------------
then on frame 120 i got
if (page = corporate) {
gotoAndPlay("corporate", 1);
} else {
}
if (page = polos) {
gotoAndPlay("polos", 1);
} else {
}
and so on and so on....for the full 11 buttons and scenes lol
so the code should be able to recognise which button was clicked and jump to the relevant scene using the page variable, ohh this is so much easier in php.
thanx for lookin guys,
me x
[CS3] Pass Variables To A Button
Hi, I would like to know, how can I pass values to a button, I mean, set the text and url for that button dynamically...
thanks
Pass A Value With A Button For The Nth Time ~
if i have 3 buttons and each has a value and i click one button how can i make the dynamic text display the button value ? how can i pass a value along with a button in this code ?
Code:
while (i<myVars.endbtn){
var thmdesc = attachMovie("description","desc"+[i],getNextHighestDepth(),{_x:xtext, _y:ytext, _width:309, _height:30});
thmdesc.desc1.text = myVars["buttondesc" + i];
ytext=(ytext+35);
//btny=(btny+35);
//desctext.text="testing ";
var thmbut = attachMovie("btn","btn"+[i],getNextHighestDepth(),{_x:btnx, _y:btny, _width:100, _height:20});
var ds:DropShadowFilter = new DropShadowFilter(2,35,0x000000,5,5,5,.8,3,false,false,false);
thmbut.btntext.text = myVars["buttonthm" + i];
thmbut.filters = [ds];
thmbut.onRelease = function(){
selected.filters = [];
thmbut.btntext.text = "test";
desc1.text = thmbut.btntext.text;
}//end function
btny=(btny+35);
i++;}
im very close to just giving up and making the page in php/hml !!
How Can I Pass A Button Value Or Parameter With Url
hi there i just start learning actionscript and i want some help in something.(1st)how can i pass a button value or parameter with url to be like this (index.html?name=anything&age=anything).(2nd)how can i select just one frame to execute an action on it in document content many layer.
thank you and i hope that i clarify my problems.
Getting Flash To By-Pass The Print Button
Hiya people.
Within a multimedia Flash presentation that I am preparing for a company that will be used by the general public, I have a set of Pdf files that are linked a set of buttons, so that some of the Flash presentation can be printed out into information handouts.
The only problem is that the company would like each of the repsective buttons to print out its pdf without the file actually opening up, and therefore someone having to press the standard print button. Does that make sense?!
So basically I would like to know if there is a way of getting flash to print out a file without opening it up infront of the Flash presentation.
Please help!
Cheers
Deadhands
Button Wont Pass Variable Properly
I've been working all day on an insanely annoying problem and I would be grateful if someone could take a look at my FLA files.
http://www.diversus.com/prototype/main3.fla
and
http://www.diversus.com/prototype/menu.fla
Im trying to pass a variable to my main movie clip from my menu swf. Then Im running an if statement to see if the variable has the value "clear", and if it does open a web page (as a test).
This is the if statement:
if (_root.navstat eq "clear") {
getURL("http://www.etherworks.ca");
}
If I place this code, root.navstat eq "clear" in the first frame of my main movie, it does exactly what I want. But inside the menu file, there are movie clips which contain buttons, and one of those buttons does this;
on (release) {
_root.navstat="clear";
}
You would think these would do the same thing, but they dont, and I cant for the life of my figure this out. Will someone look at the files and help?
Thank you
Brett
Pass URLs From An XML File To A Flash Button
Hi All,
I am getting differetn external SWF files in the main.fla file, External Flash files have called up images for my EmptyMovieClip ("imagemc") and text from the XML file, The text and images are coming up in the flash files ok, but i want to pass a URL along with each record that in flash should become the URl for GETURL command, can anybody tell me how to do that please?
I am placing my code in which i am loading the XML file and placing them in variables, and teh XML file code in which i have added the <URL> tag :
First frame of the Main Flash file
Code:
i = 0
Second frame of the Main Flash file
[code]
System.useCodepage = true;
if (i < 0) {
i = 0
}
var meuXML:XML = new XML();
meuXML.load("galeria.xml");
meuXML.ignoreWhite = true;
meuXML.onLoad = function(){
img = this.childNodes[i].childNodes[0].childNodes
texto1.text = this.childNodes[i].childNodes[1].childNodes
fidi.text = this.childNodes[i].childNodes[2].childNodes
cont = this.childNodes.length;
loadMovie(img, "imagem");
}
if ( i == cont){
i = i-1
}
Here is the XML file code :
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<FOTO>
<imagem>music/foto01.jpg</imagem>
<texto>FOTO 01</texto>
<texto2>KIMI GONZALEZ1</texto2>
<url>HTTP://www.yahoo.com</url>
</FOTO>
<FOTO>
<imagem>music/foto02.jpg</imagem>
<texto>FOTO 02</texto>
<texto2>U2 Baby</texto2>
<url>HTTP://www.hotmail.com</url>
</FOTO>
<FOTO>
<imagem>music/foto03.jpg</imagem>
<texto>FOTO 03</texto>
<texto2>KIMI GONZALEZ3</texto2>
<url>HTTP://www.cnn.com</url>
</FOTO>
I am trying to have these URLs in the button of my flash files and these URLs could be passed on via the XML file, PLEASEEE any one help me in that.
I am attching the MAIN flash file and the EXTERNAL SWF which i am calling within teh main file also.
THANKS for the support,
F.
How Do I Set A Variable Of A Button To Pass It A URL Dynamically From Cold Fusion?
I dont have to concern myself with the Cold Fusion end of things, our CF developer(s)will handle that...
I've made some Flash navigational buttons that are to be used on the front end of a very robust Cold Fusion web application.
I cannot hard code the buttons using the getUrl action because the Url will be changing dynamically.
I need to know how to set the variable of a button, so that Cold Fusion can pass it a value for the URL on the fly.
Any help would be greatly appreciated,
jOEL
How Do I Pass Radio Button Var Info To An Input Textbox?
Ok, So I can not get the radio button info to pass to my php page so that it sends me an email. How do I set it up so that if someone clicks one of my radio buttons, that is sends its info to an input text box so that I can pass the textbox info to the php page? I can at least get input textbox info to pass to the php page, so I hope I can make this a work around for my radio buttons not working. Anyone have an example script for doing this?
Thanks
Sting Variable To Mc Path - VARIABLE TYPES
Hey all Im building a variable like this
var m = "_root.subNav.subNav" + i;
When I do a trace to find the var type it comes back as a string so my function wont execute thinking it is a string and not a path. Does anyone know how to fix this or change the variable type on the fly in AS 1.0? Ive tried:
var m =eval( "_root.subNav.subNav" + i);
But that came back undefined....
Thanks.
Can't Get A Pass
Hi,
I have been trying for weeks to devise a method for a user to enter a login and pass to gain access to specific scenes. I have tried everything I can think of with no luck. Does anyone have an idea. I am trying to keep all files locally or read from a text file. I am also trying to set this up for many users. I have looked at many different tutes and examples, still, no luck.
Does A Value Value If You Cant Use A Value ? Pass Value From Btn Plz Help Thanks
Ok i have this code
Code:
while (i<myVars.endbtn){
var thmdesc = attachMovie("description","desc"+[i],getNextHighestDepth(),{_x:xtext, _y:ytext, _width:309, _height:30});
thmdesc.desc1.text = myVars["buttondesc" + i];
ytext=(ytext+35);
//btny=(btny+35);
//desctext.text="testing ";
var thmbut = attachMovie("btn","btn"+[i],getNextHighestDepth(),{_x:btnx, _y:btny, _width:100, _height:20});
var ds:DropShadowFilter = new DropShadowFilter(2,35,0x000000,5,5,5,.8,3,false,false,false);
thmbut.btntext.text = myVars["buttonthm" + i];
thmbut.filters = [ds];
thmbut.onRelease = function(){
selected.filters = [];
thmbut.btntext.text = "test";
desc1.text = thmbut.btntext.text;
}//end function
btny=(btny+35);
i++;}
how can i get the value of the clicked button ?
an easy example of what im trying to do is create buttons using actionscript and then when they are clicked pass the value to something.
I have a suggestion on how to answer this ? If you would please dont worry about my code just make me a example that creates 3 buttons using actionscript and then a dynamic text box that displays the button that was clicked, after being clicked of course .... thanks so much
im a experinced php/hml/mysql coder and ive been using the lamp setup now in php i would have just made a html button <input type=submit value=yourvalue name=button1> then a if (isset($_POST[button1]) {echo $_POST[button1];} but that wont do me any good for actionscript
How Do I Pass A Var From One Mc To Another?
Ok, so I have this little quiz I made in flash and it's a movie clip. Now I have a variable (score) that I use to tally up the score. What I'm trying to do next is tell ANOTHER movie clip that if the score is a certain number, play a certain frame in the NEW movie clip.
Right? So how do I pass that variable from the one movie clip to another movie clip and tell that clip to play at a certain frame if score=x?
I have to have this done by friday night so if anyone has ideas PLEASE let me know!
Thanks!
Pass This
How can I pass a varible to a get URL to pass to javascript
example
ActionScript Code:
ActionScript Code:
<font size="2"><font size="3">on (release) {</font><font size="3">var newW = 800;</font><font size="3">var newH = 400;</font><font size="3">getURL("javascript:restartScale(newW, newH, finalX, finalY);");</font><font size="3">}</font></font>
That doesnt work. It does work however if I just use this
ActionScript Code:
ActionScript Code:
<font size="2"><font size="3">on (release) {</font><font size="3">getURL("javascript:restartScale(800, 400, finalX, finalY);");</font><font size="3">}</font></font>
How To Pass This
This wont work
ActionScript Code:
on (release) { var newW = 800; var newH = 400; getURL("javascript:restartScale(newW, newH, finalX, finalY);");}
But this does
ActionScript Code:
on (release) { getURL("javascript:restartScale(800, 400, finalX, finalY);");}
I need those numbers to be dynamic
How Do I Pass By Val
so i am using a FLEX 3 app to open a large photo then shrink it down and save a thumb nail
i have been able to get it to open and save a new one but when i try to scale it down i get a image that is the right size but it is only the top left corner
to accomplish that much i open a file and load it with an <mx:Image/> tag then take a snapshot of that image tags contents after i have scaled the image down to the right size to take the snap shot i use the mx.graphics.ImageSnapshot and set the default encoding to the JPEGEncoder then open a filestream and save the snapshot with a ByteArray.
but the image will not scale right.
How Do I Pass A Var From One Mc To Another?
Ok, so I have this little quiz I made in flash and it's a movie clip. Now I have a variable (score) that I use to tally up the score. What I'm trying to do next is tell ANOTHER movie clip that if the score is a certain number, play a certain frame in the NEW movie clip.
Right? So how do I pass that variable from the one movie clip to another movie clip and tell that clip to play at a certain frame if score=x?
I have to have this done by friday night so if anyone has ideas PLEASE let me know!
Thanks!
Can't Pass Variable
Hi,
I have a movie where I define a variable "botsim=20" in one of the first frames. Then, later in the movie I want to call this variable from a movieclip timeline by using it in something like "john=botsim+5". However the movieclip hasn't been able to call the "botsim" variable. Is it not possible to pass a variable from the movie timeline to a movie clip timeline?
Dan Riley
Variable Pass
Hi
I have several drag and drop movie clips which ask the User to place coded books (Dewey referencing code) onto numbered targets on a bookshelf.
I can program the movie so that it can check how many items are in the correct sequential order and gives the user three chances to get it right before loading the next movie clip.
What I am *desperate* to know is ... how do I keep a running score of correct attempts to be displayed at the end of the movie sequence?
*Any* suggestions would be appreciated ... I just need to carry the score from movie to movie (I think???)
--Rhi~
Pass Variable From JS To AS
Please Help!
Does anybody know how I can pass a variable from JavaScript to ActionScript (getVariable?)!
THX
How Would I Pass A Parameter...
How would I pass a parameter (or any method) into a scrolling text box?
The parameter would come from a .jsp file. It would function exactly like an <iframe>
It would work like this.... (I run a affiliate program)
I send out an email to my clients with new links.
The problem is some 1000 of my clients have Yahoo and Hotmail accounts, and both services will replace my links with theres. So I will create a flash text box that will be independent of those meddlesome kids.
When the email is delivered it calls the flash file which in turn fills the text boxes with dyn. data. And my clients cut and paste the untouched code into there pages.
Pass Variables Between Different Swf >> HELP
This is quite simple.
I'm loading 02.swf inside 01.swf...
Code:
loadMovie ("02.swf", _root.screen)
That's OK
Now I want to pass some information from 02.swf to 01.swf before it's starts
In other words, I want to pass some variables to the main swf
Does anyone have an idea?
Thanks
Renato
Can't Seem To Pass A Variable Into Another Mc.....
Hey,
I'm experiencing a peculiar little variable problem:
I have a button:
Code:
on(release){
WinName = "lea";
_root.attachMovie("Gallery", WinName,559);
_root[WinName]._x = 200;
_root[WinName]._y = 200;
_root[WinName].ModelName = "lea";
this.NumThumbs = 5;
for (i=this.NumThumbs+1; i<=16; i++){
_root[WinName]["Thumb"+i]._visible=0;
}
}
this is the line i'm having trouble with:
_root[WinName].ModelName = "lea";
the "Gallery" clip attaches itself properly and receives this variable. And then the peculiar behaviour starts.
on the top layer, i use that variable to fill a text field. This works.
the layer below that, i have a movie clip which contains a button. the movie clip as:
Code:
onClipEvent(load){
this.ThumbNumber = 1;
this.ImageNumber = "01";
trace(ModelName);
}
the trace on ModelName comes up as undefined. I can't do a full path reference to the variable because the instance name of the clip is the same as ModelName.
it does work if i make ModelName a global variable, but that messes up the rest of the movie.
Any suggestions?
Cheers,
Ben
Pass A Variable
I have a button on a index.swf on level 1. I want this button to load awards.swf on level 2 and send a variable to awards.swf so that it opens at a certain point in a scrollable text.
I can get this to work if the variable value is set in awards.swf. Is it possible to send a variable value across different movies? If so, how.
Thanks
Robert
Pass Variable From One Swf To Another
hi
Well i am making a cd presentation in flash ...
i have 4 main movies(swf) with sound clips each has a mute button... if the mute button is clicked its stops sounds and passes a variable _root.check="off" ... but when i click on the link to other movies its gets enable again and the sound starts playing again ... i want this variable i.e _root.check to pass accross all the movie i click.
which means if i have click the mute button all the other swf files or movies i load should be muted...
please help me soon.
regards
kapil
ps deathline is tomm..
Pass Variables From One Swf To A Second Swf?
Help! I have two movies and I want the first to pass a variable to the second movie.
loadMovieNum("second_movie.swf", 0, "POST") just doesn't seem to do it. My second movie plays but does not receive the variable.
I have tried loading the second movie into a new level rather than replaceing the first but that doesn't work either.
GET also will not work.
I'm trying to do this locally so I can run the swfs from a CD.
How Do I Pass A Variable From...
..the main timeline to a loaded movie clip.
Layout: Main timeline contains audio voice over. Keyframes swap the value of silent from 0 (talking) to 1(not talking).
Movie clip is an 4 keyframe, 8 frame movie made to loop randomly. Frame 1 contains the mouth not talking, frames 3,5 and 7 have the mouth in various vocal positions (2 frames each mouth position).
In each frame of the movie clip I have the following script:
while (_level0.silence==0) {
var mouth=Math.round(Math.random()*3)
gotoAndPlay((mouth*)+1);
}
gotoAndPlay(1);
When I test the movie, I get an error message "A script in this movie is causing your computer to run slowly. Abort this script?"
Upon aborting the movie clip plays, but looping sequentially.
How can I fix this?? Tell me this is an easy one....
How Can I Pass Variables
can someone tell me how can i pass variables to a flash movie through html or asp pages?
merry christmas and thanks in advance
Baljit Singh Grewal
Boy, Do I Need To Pass A Variable
Okay~
so I started messin with the "menu dropdown" file included in Flash MX. Its the nice vertical heirarchy navigator with clickable entries. Its all controlled via an .xml file.
What Id like to do to make the interface more user friendly is to have it not collapse the menu items upon reload.
Each time the user clicks a link it reloads the .swf and effectively closes the section the user was looking at.
Macromedia uses this interface and theirs seems to remain open through page loads...anyone know how?
The link above is what Im working on. Its not complete so dont flame me for dead links, or errors.
Doug
How To Pass Data From One Swf To Another
hi,
I have an external .swf file that has a button (really a movie clip) on it. I'm loading it into a scrollpane component in my main swf file. When i click on the button i need to load something into my main swf and that works fine. However, when i click the button (in my external swf file), i also want to pass data to the main. In addition, i need to be able to capture that each time i click the button (the data that the button will pass will change over time).
Any ideas? Thanks.
|