Concatenation With Buttons
what i have and what i want:
what i have:
on a very basic button:
Code: on (release) { array.push("blue");
for (var i = 0; i < array.length; i++) { resultBox.htmlText = (array[i]); } } on a file called main.as
Code: class Main { var size; function createArray(size):Array { return new Array(size); } } what i want is to click on my button and send the data somewhere then concatenate them together so that they all become one element on my array.
example: i click on button that says blue. then i click on button that says red, then i click on button that says green.
i want them to be concatenated when i look at element on the array, so the result should be blueredgreen all one word.
is this possible? what i am thinking of here is something like c++ where cin takes all of the info (where ever its coming from) then puts in the variable together.
any ideas, as always thank you so much in advance.
Hector
FlashKit > Flash Help > Flash ActionScript
Posted on: 12-15-2004, 04:42 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Concatenation
Hi,
Can anyone advise me on how to successfully concatenate this?
_root.status = this.hitTest(_root.movieclip1.mcDart);
I need to replace "movieclip1" with a variable string. I could just go through the whole damn movie, changing all the scripts, but it would take forever, so I want to set up the actionscript so I can just change a single variable.
I've tried this, but it didn't work...
_root.status = this.hitTest ("root." + variablename + ".mcdart");
I get an error, I think because of the use of the quotation marks????
Any help?????
Simon.
Concatenation
I'm pretty sure I've done this before, but I can't remember how. What I want to do is concatenate a string "test" with a array value to create the name of a variable, which can then be tested. Something like the sample below. Can anyone tell me how to do this? I can't remember, and I'm not much of a programmer.
test1 = 3;
test2 = 5;
test3 = 8;
testvar = array(1,2,3);
for(i=0,i<3,i++)
{
trace("test"+testvar{i})
}
Thanks
Concatenation
Hi,
I always get stumped on concatenation & hope you can help...
I have a numeric variable:
_root.levelNum
And I have this line of code:
_root.test = _root.table.L1score3;
how do I successfully replace the "1" in L1score3 with the variable _root.levelNum ???
I'm really stuck with this.
I tried this:
_root.test = "_root.table.L"+_root.levelnum+"score3";
...but it doesn't work.
Any ideas?
Thanks,
Simon.
Concatenation Of ?
Hi:
I have ten buttons (numbers 0-9) and one input text field. When each button is pressed, I want to change the value of the text field.
What I need help with is adding the value of each button to the other, concatenation of strings, so that the value of the text field is equal to every button pressed. In other words, if you press 4, then 3, then 2, the value of the text field would not be 2, or 9, but 432, and so on.
Thanks,
James
He is risen!!!
Concatenation?
Hi Guys,
I'm looking to add a variable 'i' onto the end of a string. I can do this as in the following example:
onClipEvent (load) {
_root.Titles.play();
_root.Titles.Blip.attachMovie("Title" add _root.VarControl.i, "Title", 10);
}
Which varies the moviclip to attach according to the variable 'i'
However, I also want to be able to vary the instance that a movieclip is attached to later on in the movie as in this example:
onClipEvent (load) {
_root."EmptyDisc" add i.attachMovie("FlashWin", "FlashWin",8)
_root."EmptyDisc" add i.attachMovie("AllStars", "AllStars",9)
}
But this code doesn't work. I'm assuming there are different rules for concatenation with instance names.
Does anyone know how I can work around this?
Cheers,
Owen.
XML And Concatenation? Help
I have a VERY big XML file, and I would like to have the for loop add ".nextSibling" using += to add it for each new sibling. But I am unable to concatenate it properly and I keep getting the ACTUAL string of:
allData[0].firstChild.firstChild.nextSibling.firstChild
allData[1].firstChild.firstChild.nextSibling.nextSibling.fir stChild
Etc...
How can I make Flash understand that I want is to read the XML file, rather than spit out the string?
My Code...
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
if (success) {
alldata = this.firstChild.childNodes;
for (i=0; i<allData.length; i++) {
xsib += ".nextSibling";
xml_sib = _root[alldata];
trace(allData[i].attributes.name);
trace(allData[i].firstChild.attributes.name);
trace(allData[i].firstChild.firstChild.firstChild);
trace(allData[i].firstChild.firstChild.nextSibling.firstChild);
trace(allData[i].firstChild.firstChild.nextSibling.nextSibling.fir stChild);
trace("---");
trace("allData["+i+"].firstChild.firstChild"+xsib+".firstChild"); //This is the line I want to read the XML file!
trace("---");
}
} else {
trace("error");
}
};
myXML.load('myfile.xml');
Concatenation
Hi All,
I'm having a problem with adding a variable in this AS:
myVar = _root.flash_link;
_root.MAIN.nav.+myVar+.gotoAndStop(2);
The "flash_link" is a dynamic text field that I know has the value of "home". But it's not passing it.
When I substitute "home" for myVar it works.
thanks
Concatenation
I get this in a variable returned from PHP
Code:
line0player0f
Then i need to write this to a dynamic field which the below does:
Code:
rfcTfd3.htmlText = NewsLoad.line0player0f+"-"+NewsLoad.line0player0o;
However the '0' in the variable that are bold need to by dynamic through the loop increasing but i dont know how to concatenate 'nbrClip' to where the 0's are. As the variable is not a string this will not work and im lost as to what to do and how to concat them both.
Code:
rfcTfd3.htmlText = NewsLoad.line+nbrClip+player+nbrClip+f+"-"+NewsLoad.line+nbrClip+player+nbrClip+o;
^^^^^ dont work.
AS3 - Concatenation (again...)
alright there mateys.... i have this code..
Code:
function init():void {
var ac0:ActionsTab0 = new ActionsTab0();
addChild(ac0);
trace(ac0);
}
which is all good, i get [object ActionsTab0] when i test.
but if i try this it doesn't work...
Code:
function init():void {
var ac0:ActionsTab0 = new ActionsTab0();
addChild(ac0);
trace(this["ac"+0]);
}
i get "ReferenceError: Error #1069: Property ac5 not found on ActionsArea and there is no default value."
now i know its because the variable isn't on the 'this' level but how do i refer to it. what is the alternative to 'this'?
what i want is for trace(["ac"+0]) to work but i don't know how to say it... can you help?
cheers.
koose.
Concatenation
i want to control variables 1-41 ising a for loop with i as the loop condition.
ex: bgmc1, bgmc2 bgmc3, and so on....
heres what i have
onClipEvent(enterFrame){
_root.ani_level0.ani_level1.bgmc add i.play();
i++;
}
that doesnt work, neither does using 'and' or '+' im lost here. i know the target's correct just need the proper concatenation syntax.
thanks
Concatenation
I'm pretty sure I've done this before, but I can't remember how. What I want to do is concatenate a string "test" with a array value to create the name of a variable, which can then be tested. Something like the sample below. Can anyone tell me how to do this? I can't remember, and I'm not much of a programmer. (I didn't make sure all code was correct, but I think you can get idea.)
test1 = 3;
test2 = 5;
test3 = 8;
testvar = new array(1,2,3);
for(i=0,i<3,i++)
{
trace("test"+testvar[i])
}
Thanks
Concatenation Problems
here the situation;
ca=random(4);
2
cr=random(14);
9
cd=ca+cr;
i keep getting the sum of ca and cr: 11, not cacr: 29, like i expect.
what am i expecting wrong?
thanks in advance.
Jeff
Concatenation Problem
I'm not very strong with AScript so I could use some assistance.
I know these 2 concat's work:
Code:
btn_[+area].gotoAndStop(10);
_root.btn_grp.dd_bar.dd1_[+area]._visible = true;
but this doesn't:
Code:
btn_[+area].onPress = function (){ ... }
I tried breaking it up and declaring beforehand, ie.
Code:
var btn:String = "btn_about";
btn.onPress = function (){ ... }
but it still wouldn't work.
Does anyone know a way around/through this?
Multiline Concatenation
hi guys,
i was wondering if you can add on to a string in a new line, like in php it would be:
Code:
$a = "Hello ";
$a .= "World!";
i know i could do it in flash as
Code:
a="hello";
b="world";
c=a+b;
but i want to add to a string each time in a loop so it would ideally be something like:
Code:
a="blah blah blah"
for (i=0; i<=30; i++) {
a .="blah"+i
}
thanks guys,
Simple (?) Concatenation
Does anyone know how I can shorten this unwieldy chunk into something much more elegant?
Thanks
Code:
panelStilllife_mc.thumbStill01_mc.onRollOver = over;
panelStilllife_mc.thumbStill02_mc.onRollOver = over;
panelStilllife_mc.thumbStill03_mc.onRollOver = over;
panelStilllife_mc.thumbStill04_mc.onRollOver = over;
panelStilllife_mc.thumbStill05_mc.onRollOver = over;
panelStilllife_mc.thumbStill06_mc.onRollOver = over;
panelStilllife_mc.thumbStill07_mc.onRollOver = over;
panelStilllife_mc.thumbStill01_mc.onRollOut = out;
panelStilllife_mc.thumbStill02_mc.onRollOut = out;
panelStilllife_mc.thumbStill03_mc.onRollOut = out;
panelStilllife_mc.thumbStill04_mc.onRollOut = out;
panelStilllife_mc.thumbStill05_mc.onRollOut = out;
panelStilllife_mc.thumbStill06_mc.onRollOut = out;
panelStilllife_mc.thumbStill07_mc.onRollOut = out;
Problem With Concatenation
Hi all.
I'm new to this forum. I'm a PHP - MYSQL programmer who is trying to code in actionscript
I have an issue with the concatenation of variables names. I'm pretty sure this is simple but I cant find any help on the web for this problem.
Here's how I want my code to work:
let's say I have 5 symbols each named btn1, btn2, btn3, btn4 and btn5.
I want to create a while loop where all those would become invisible :
var total=5;
var ct=0;
while (ct<total)
{
"btn"+ct._visible=false;
ct=ct+1;
}
both my ("btn"+ct) and (ct=ct+1) does not seems to work.
Can anyone help?
And don't answer "just copy and paste the _visible=false code 5 times" cause I'll reply "Ok, and what If I have 100 000 000 of those buttons?".
Thanks everyone.
--> Flames
More Concatenation Issues
I'm sure this will be an easy one for someone (or many) out there;
I need to concatenate a variable to a goto frame label action as below.
var = myDate;
myDate = d0802;
on (release) {
_parent.photoChoice.gotoAndStop(myDate + "07");
}
so obviously I have a frame label d080207 in a clip photoChoice.
Everything works fine if i don't use the variable its just that my syntax must be wrong.
Anyone know the answer?
thanks heaps in advance
Chris
Concatenation Problem
I have the following lines of code:
-------------------------------------------------------------
_root.print_mc.createTextField("printNumber"+i+"_t xt", 0, 20, 190, 200, 20);
_root.print_mc.printNumber+i+_txt.border = true;
-------------------------------------------------------------
Line 1 is fine. I will increment by 1 each time to create new text boxes. Line 2 is the problem, specifically 'printNumber+i+_txt'. How do I write this so that I can reference the correct text box each time?
TIA,
Adrian
Concatenation Question...
Can some explain why this doesn't work?
ActionScript Code:
onClipEvent(load) {
cycleNum = 0;
}
onClipEvent(enterFrame) {
photoNum = ("photo" + cycleNum);
_parent.photoNum._alpha = 100;
trace(_parent.photoNum._alpha);
cycleNum ++;
}
"trace(_parent.photoNum._alpha);" keeps returning undefined, though when I try "trace(_parent.photo1._alpha);" it returns correctly.
This is so simple...what an I missing?
Concatenation Question
I can't seem to figure out how to concatenate this:
getURL("javascript:LightboxDelegate('../../images/portfolio/commercial_1/' + [whichOne + 1] + '.jpg', 'blabla')");
This part is the problem:
'../../images/portfolio/commercial_1/' + [whichOne + 1] + '.jpg'
How would I do this.
Thanks a lot for any help!!!
String Concatenation
Hi all,
I have an XML file which would parse the words and gives me a result as 01,02,03...10.
I have another XML which would parse similarly and get me a result 01,02,03,04....10.
Now I want to bring a result like 01,02,03.....09,10,01,02,03....10.
After this I want to loop back to the start of the string.I know that i have to check EOF but I dont know how to do this
Can anyone explain me with the actionscript code..??
Thanks in advance..!!
Nirmal.
AS3 - Concatenation Problem
hey guys. i'm having a bit of a sunday brainmelt. i can't get the following to work!
here is my code
Code:
package {
import flash.display.*;
public class MasterClass extends Sprite {
//*****************************INIT VARS********************************
static var avatar0:Array = new Array(1,1000);
static var avatar1:Array = new Array(1,2000);
//************************CONSTRUCTOR FUNCTION**************************
public function MasterClass() {
init();
}
//************************INIT FUNCTION**************************
public function init() {
for (var i:int=0;i<2;i++){
var avit:AvatarArea = new AvatarArea(avatar0[0],avatar0[1]);
addChild(avit);
}
}
}
}
now this all works fine but as soon as i try to replace the for loop command with this:
Code:
var avit:AvatarArea = new AvatarArea(this["avatar"+i][0],this["avatar"+i][1]);
i get this:
ReferenceError: Error #1069: Property avatar0 not found on MasterClass and there is no default value.
at MasterClass/init()
at MasterClass()
what should i do? thanks in advance if you can help.
Strange Expression Concatenation
I'm calling a function to total and re-total a shopping cart. It works perfectly the first time it is totalled, but after that it concatenates the subTotal and shippingTotal variables into the grandTotal. In other words, the first time it adds the subTotal (eg. $13.00) to the shippingTotal (eg. $2.00) to total $15.00, but if it has to re-total, calling the exact same function, it ends up concatenating the totals like so: $13.002.00.
Here's the code if anyone can help:
function total () {
subTotal = t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12+t13+t14+t15 +t16+t17+t18+t19+t20;
shipTotal = s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12+s13+s14+s15 +s16+s17+s18+s19+s20;
shipHigh = 0;
shipAdd = 0;
do {
shippingTotal = 5.50+(shipAdd*2);
shipHigh = shipHigh+3;
shipAdd = shipAdd+1;
} while (shipHigh<_level0.shipTotal);
if (shipTotal>0) {
grandTotal = subTotal+shippingTotal;
} else {
shippingTotal = 0;
grandTotal = subTotal+shippingTotal;
}
Basic Concatenation Problem
Need help associating this string with the symbol:
Code:
var n:Number = this._parent._parent.nextFlash;
var nf:String = eval("b"+n);
var nfl:String = eval(nf+"_flash");
//also tried "b"+n+"_flash"
this._parent._parent.nf.nfl.gotoAndPlay(2);
//NO ERROR, but will not play either
I also tried :
Code:
this._parent._parent.b[+n].b[+n]_flash.gotoAndPlay(2);//RETURNS ERROR
//AND
this._parent._parent.b[+n].b[+n][+"_flash"].gotoAndPlay(2);//NO ERROR, but will not play either
I looked through a bunch of posts and they all suggested either concat() or eval, both of which I tried so there must be something else I'm missing. Also Var debugger shows nf and nfl as undefined using eval(). Tried evaluating full path but still undefined.
As always, I appreciate any and all suggestions. Thanks.
Concatenation In A FOR LOOP. This Should Work?
Hi,
I'm using a FOR loop to apply myButton[i].onRelease functions to multiple buttons. Each button is about 3 levels into their own MC's. I'm trying to dig down to them - my trace is returning the correct values. But when I try and use the final path AS doesn't like it.
Code:
for (i=1; i<4; i++) {
currentBtnHolder= _root["btnHolder"+i];
currentBtnFrame = currentBtnHolder["btnframe"+i];
currentBtn = currentBtnFrame["btn"+i];
trace (currentbtn)
//this gives me the correct path
currentbtn.onRelease = function() {
DO SOMETHING
//And this is where it all falls down
};
}
Be great if you could tell me why - I've had problems with this before and always got round them by using a single concatenation, but I can't do this here.
Thanks for looking
Styling One Element Of A Concatenation
A user types input into 5 or so text fields. Following this a button is clicked which triggers a concatenation of all the fields. The result (with added spaces and punctuation) is then displayed in another field. The catch is that one of the input fields has to displayed as italicized. I have set a new format for the specific input field that causes the input text to be displayed as italicized. However, when all the fields are added together and displayed in the new text field, the formatting is either dropped or the text Field instance name is displayed.
I can post specific code but basically it is this:
//create format for input field
var myformat_fmt:TextFormat = new TextFormat ();
myFormat _fmt.italic = true;
this.onEnterFrame = function () {
myTextField_txt.setTextFormat(myFormat _fmt);
}
//a button to cause concatenation and display of results
createTxt_btn.onRelease=function (){
var myStringA_str:String = new String(textField1_txt + " (");
var myStringB_str:String = new String(textField2+ "). ");
//concat field called "complete_txt is displayed, html properties are set
//this includes a botched attempt to add HTML formatting...crap ensues
complete_txt.html = true;
complete_txt.multiline = true;
complete_txt.wordWrap = true;
complete_txt.htmlText = myStringA_str + myStringB_str + "<i>myTextField_txt.</i>" +".";
}
The above code produces italic formating in the final string but I get the instance name (myTextField_txt) instead of the content of that field! Is there some operator that lets you use HTML tags with strings?
There seems to be no documentation that talks about this specific case. Even if I don't use the strings and set the htmlText to be a mega-concatenation the required italic formating is shown with the name of the text field.
(Meanwhile my cubicle neighbor keeps laughing and telling me to ditch Flash and use Java but that's another forum topic)
Any thoughts would be very helpful.
Bill
ExternalInterface.call, Concatenation, Xml- Help
Hello. I have this working:
Code:
ExternalInterface.call("hsDelegate('pic.jpg','this is the caption', 'hs-anchor')");
That launches a picture with a caption. hs-anchor is just a div needed for the JS I'm using. Anyway, it works fine. My trouble is when i try to use XML instead. I have tried different combinations of quotes and "+" but don't know how to write it.
The pictures from xml would be : event.item.link, the captions are: event.item.title
So I am trying things like:
Code:
ExternalInterface.call("hsDelegate('+event.item.link+', '+event.item.title+', 'hs-anchor')");
which I know is wrong and need help with. Basicly, I just don't understand how to use the quotes, double quotes, and + concatenation to call the same thing as the working first example.
thanks for any help!
Thanks for any help.
.txt Variable And Wrong Concatenation
hello,
i have a little problem with a variable loaded from a .txt
for example:
what i have in my .txt is: &cover=dp
i load my .txt in my swf
and i do a trace to check: trace (loadInfo.cover+"jpg");
i actually get:
dp
.jpg
instead of dp.jpg on the same line.
i don't know how to deal with it.
String / Mc Concatenation Question
I am trying to make a Flash map of the US to monitor the upcoming elections. I want Republican states to show up as red and Democrat states to show up as blue, etc. I am pulling some variables from my database and I am loading them into my Flash movie through the "flashtest.asp" file. I've verified that my variables are coming into the Flash movie correctly, but I can't seem to grab their values and make my states change colors as I want - I think I am not building my variable and movie names correctly...
_root.loadVariables("http://localhost/politics/flashtest.asp",0)
stateArray = ["AK","AL","AR","AZ","CA","CO","CT","DC","DE","FL","GA","HI","IA","ID","IL","IN","KS","KY","LA","MA","MD","ME","MI","MN","MO","MI","MN","NC","ND","NE","NH","NJ","NM","NY","NV","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VA","VT","WA","WI","WV","WY"];
for(i=0; _root.stateArray.length; i++) {
if (_root[stateArray[i] + "_status"] == "Republican")
{
tempColor = new Color(_root[stateArray[i]+"_mc"]);
tempColor.setRGB(0xff0000);
}
if (_root[stateArray[i] + "_status"] == "Democrat")
{
tempColor = new Color(_root[stateArray[i]+"_mc"]);
tempColor.setRGB(0x0000ff);
}
}
...any ideas? thanks.
Concatenation Inside Loop
Hello dudes
Im having this little problem with action scripting, not used to it
inside a loop im trying to assign a variable to another
its very simple
fid_0 will receive the value of narr_0[0]
fid_1 will receive the value of narr_1[0]
fid_2 will receive the value of narr_2[0]
fid_3 will receive the value of narr_3[0]
and so on...
notice the red numbers? they are the var i, the index of my loop
im trying to do this doing the following:
set("fid_" + i,"narr_" + i + "[0]");
i also tried set("fid_" + i,eval("narr_" + i + "[0]"));
too bad its not working, what am i doing wrong?
thanks a lot in advance!
Mathematical Addition Instead Of String Concatenation
I have a variable _global.score that starts set to 0.
If the user gets an answer right, _global.score=_global.score + 1 gives a number.
In a second area, the same thing works for _global.score2
However, I want to add the numbers from _global.score and _global.score2. When I try that, I get a concatenation instead, for example 11 instead of 2. Is there some way to get the result I want?
Oh, and I'm using MX.
Using String Concatenation To Get Property Object, Please Help Me
Hi, I'm an ActionScript newbie, and I would like to ask you a very simple question because this problem is making me crazy.
This is a simplified part of my script:
Dati_colori = new LoadVars();
Dati_colori.load("immagini/colori/"+_root.num_img+".txt");
The file is this:
&num=3&colore1=0xFF0000&colore2=0x00FF00&colore3=0x0000FF
The first variable is the number of colors (that are the other variables)
After the file is loades, I can access to the values by writing:
Dati_colori.colore1, Dati_colori.colore2, ecc ecc.
Now the problem: I would like to put this in a for cicle:
colors is an array containing the values
for (a=1;a<Dati_colori.num<a++){
colors[a] = Dati_colori.colore+a //this concatenation DOES NOT WORK!! I cannot access this way to the property containing the
}
Maybe it is just a formal problem but I cannot succeed in using string concatenation to get the property value.
Thanks in advance for any suggestion!
Davide (from Switzerland)
Concatenation, Variables, Input Text Fields
Hello,
I am brand new to actionsripting and I'm taking a class.
Our first assignment is to make an interactive "madlib" where a user can control what goes into noun, adjective, adverb input text boxes.
Once the user has typed text into those input text boxes, he/she clicks a button and the input text is merged with a story. Remember doing these?
I am new to this and have consulted manuals and lynda.com lessons.
I have built the shell with 15 or so input text fields, the button, and the dynamic text box that will serve as the display window.
Here's a short description of the user experience:
user types in a noun: Noun ______ example: Everyone likes to ride a ____.
Does the same to 15 more input text boxes,
pushes the button, and the text merges with the story text
with a funny end result. The input text will be one color and the pre determined story will be another color.
I'm thinking that I have to weave the interactive text with the predetermined story text somehow. I'm sure this is a no brainer to most of you, but like I said I'm new to it and I'm slightly tech phobic.
Any help would be greatly appreciated!
_Oolias
Buttons, Buttons, And More Buttons...oh And Movie Clips Too
MY QUESTION IS AT THE END and UNTIL THEN IS A BACKGROUND... PLEASE HELP!
moving along...
Ive now made several .fla files for my hour long movie. each .fla file ranges from 2-20mb. not too shabby... Ive done the load movie thing and it ran fine... i havent put any sound yet.. but i'll ask about that question later...
okay.. so the whole thing has about 30 slides... i have 5 .fla files which has 3-5 movie clips in each... each movie clip has about 1-3 slides.
everything is fine so far... (no audio, but im not there yet)
Since i dont have sound cutting software currently... i thought id make movie controls for this video....
originally i put the controls in the original timeline.. not the movie clips.. but my pause didnt work and my play acted like a fast forward... my fast forward would go to the next movie clip(which i anticipated)... but I wanted the fast forward to jump every 12frames..
so here comes the problem....
i copy pasted the buttons in the same exact place in every movie clip.... so it should ,in theory,work like it was on one timeline.. but it wont export.. the file is still the same size.. (insignificantly larger ,less than a mb)..
my question is:
does having buttons on every movie clip ( which frames length range from 400-2000, avg.1000) have a problem with flash...??????????not allowing me to export.. or maybe it's just having so many errors it wont run... in fact... when i close it down (because it wont let me cancel..) it wont let me re open the .fla again.. unless i restart the computer
[F8]Buttons, Buttons, Buttons Dynamic Text?
Hi
I've got a set buttons that are different instances of the same mc. I'd like to make labels for each button but I don't want to have to duplicate all the buttons in the library and add the labels separately.
I think I need to to this with Dynamic text but that as far as I've got with the searches I've done on Google.
Thanks in advance for any help.
ActionScript In Buttons To Reference Movie Clips Inside Buttons
I want to reference a movie clip inside a button, to use tell target on the button. Is there a way to use something like:
tellTarget (this.movieclipname) {
}
that way i can use multiple instances of one object, rather then having to make a different action for every single time i want to use it.
Hiding Buttons Or Movie Clips With Buttons With Actionscripting
Greetings,
I really need someone's help. I am trying to hide buttons from screen when certain conditions are set. For example, I have a variable called Amount. Now, I have a textfield that displays the value of Amount. Three buttons are visible. Each button has actionscript so when click each button would subtract some amount from the variable Amount. Button 5 will subtract 5 from Amount and button 10,20 accordingly. Now, when Amount is less than 20. I wanted to make the 20 button disappear from the screen (not using timeline, object oriented actionscripting). Then when Amount is less than 10 the 10 button will disappear.
I tried making the button disappear with "five._visible=false;" However, I was told I could not do that with buttons. So, i created a movie with button inside. It disappears with "moviefive._visible=false;" But the button does not work when visible. I can see the little hand when I place the mouse over the button, but it does not work. It does not subtract from the variable Amount.
When someone clicks the five button, five button has code that will subtract 5 from Amount and if statements that will "twenty._visible=false;" if the Amount is now less than 20.
Could someone please help me. Thank you very much. I really appreciate any assistance you could provide.
Thanks again
Multiple Buttons Loading MC Buttons On Single Stage
Hello,
I need three buttons , working independent of each other, to "turn on" the MC in three seperate boxes, all on the same timeline- further, I want these MCs once "turned on" to actually be buttons that can then send the user to a different page. I can make this work if it's only one button, using two frames (by "hiding" the already launch MC over the top of it- then sending the link to frame two etc) but I need ALL three buttons visible, in whatever order the viewer clicks them! (Think of a wall with three windows and the MCs are the window images!) SO: the viewer clicks a button (any or all three) that turns on the movie clip and the movie clip can then be clicked to launch to a new page. Is this even possible?
-sorry for the long explanation- thanks for any help!
ras.
Dynamic Text For Multiple Buttons W/ Scroll Buttons/bar
HELP! I know a similar question to this has appeared multiple times before, but here is my situation:
i have four buttons, each of which will load a a separate text file into a dynamic text field (ie: button A to textfield 1, button B to textfield 1).
The other trick is, this also has a custom scroll bar. (I would rather just use an up and down arrow, but if i have to use a bar as well, I will not be too distraught.)
Is there a way that I can have all the text files loads in a dynamic text field PLUS have a scroll bar to aid with scrolling.
Any help would be greatly appriciated. I have been trying to figure this out for about a week now, and am still no where.
peter /slqu.net
ps: i am a designer, and for some reason, programming, even of the most simple nature, still eludes me. so please take pity me
Avoiding Paypal Shopping Cart Buttons - Need A Way Around Buttons
Hi - I'm on MX; my client wants a VERY minimal site. I'm using his Paypal business account to sell merch, and the process is pretty easy to set up...EXCEPT that he wants to avoid the buttons provided by Paypal. They provide the HTML to paste in for said buttons; I'm using dynamic scrolling text, pulling from an external .txt file. I know how to HTML format for links, etc. - is there a way to bypass the use of an actual button, and just use text links for the "add to cart" and "view cart" buttons? I know that if I upgraded to MX 2004, I would be able to place images (buttons) in my dynamic text - but that is a moot point, as he wants to avoid buttons altogether. I'm copying the HTML code Paypal offers for the add to cart button below:
------------------------
form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
input type="hidden" name="add" value="1">
input type="hidden" name="cmd" value="_cart">
input type="hidden" name="business" value="willyt14@aol.com">
input type="hidden" name="item_name" value="Hilarity and Despair">
input type="hidden" name="item_number" value="001">
input type="hidden" name="amount" value="10.00">
input type="hidden" name="no_note" value="1">
input type="hidden" name="currency_code" value="USD">
input type="hidden" name="lc" value="US">
input type="hidden" name="bn" value="PP-ShopCartBF">
/form>
-------------------------
Thanks so much!
Targetting 'Hit' State On Buttons/immediately Disabling Buttons
Hi,
I have a button which, when clicked on, is set to disable itself. However, when it's clicked, the mouse is obviously still over the button and so the 'Over' state is shown - which implies that the button is still active. I don't want this - I want the button to be completely disabled as soon as it is clicked. If I move the mouse away from the button then it becomes completely disabled.
See here:
http://www.russellgillman.co.uk/testmenu.swf
When you hover over the buttons the text becomes yellow. When I click on a button, the green block moves to the selected button and the button is disabled, and yet the text remains yellow. I want it to become white immediately.
Code on the button:
Code:
on (release) {
services_btn.enabled = false;
getURL("www.site.com", "mainFrame");
slider.xMove = services_btn._x;
about_btn.enabled = true;
rates_btn.enabled = true;
rental_btn.enabled = true;
sales_btn.enabled = true;
coverage_btn.enabled = true;
contact_btn.enabled = true;
}
What I'd like to do is to target a specific frame in the button - eg:
services_btn.gotoAndStop("Hit");
but this doesn't work.
Can some help please!? Thanks...
Buttons Whos Actions Depend On States Of Other Buttons -HOW?
Hi,
I’ve made a 3D animation as a background to my homepage, and have imported it into Flash CS3 as a series of still TIFF images (one image on each frame).
Now I am looking to control this animation using a series of 9 buttons. At the moment each button does the following:
Button1: Play frames 01 – 20. Stop.
Button2: Play frames 21 – 30. Stop.
Button3: Play frames 31 – 40. Stop.
…etc.
However, I want to make each button’s action dependant on the states of the other buttons:
When the user presses any of the 8 buttons other than the one that is currently engaged, I want the animation relating to the button that is currently engaged to be played in reverse, and then the animation belonging to the button that has just been pressed to be played!
For example, if Button 1 has been pressed, then the user presses Button 2, I want frames 20 – 01 and then frames 21 – 30 to be played. Another example; Button 3 is engaged, user presses Button 1 – frames 40 – 31 should be played and then frames 01 – 20.
If anyone could help me with the ActionScript to perform this (ideally AS3 but AS2 is fine) then I would be extremely, extremely grateful.
Thanks in advance for any comments.
Ben.
Buttons Whos Actions Depend On States Of Other Buttons -HOW?
Hi,
I’ve made a 3D animation as a background to my homepage, and have imported it into Flash CS3 as a series of still TIFF images (one image on each frame).
Now I am looking to control this animation using a series of 9 buttons. At the moment each button does the following:
Button1: Play frames 01 – 20. Stop.
Button2: Play frames 21 – 30. Stop.
Button3: Play frames 31 – 40. Stop.
…etc.
However, I want to make each button’s action dependant on the states of the other buttons:
When the user presses any of the 8 buttons other than the one that is currently engaged, I want the animation relating to the button that is currently engaged to be played in reverse, and then the animation belonging to the button that has just been pressed to be played!
For example, if Button 1 has been pressed, then the user presses Button 2, I want frames 20 – 01 and then frames 21 – 30 to be played. Another example; Button 3 is engaged, user presses Button 1 – frames 40 – 31 should be played and then frames 01 – 20.
If anyone could help me with the ActionScript to perform this (ideally AS3 but AS2 is fine) then I would be extremely, extremely grateful.
Thanks in advance for any comments.
Ben.
Replacing Dedicated Gallery Buttons For Next/prev Buttons
Hey all, I could use some help with this. It's probably something simple but it beyond my current abilities - any assistance would be aprreciated.
Well I'm using the code from one of the XML gallery tutorials. Currently the code has dedicated buttons for each individual gallery, however I'd like to change it so it only uses next/prev buttons and perhaps use an XML file to establish how many galleries there are, that way it would be easier to add additional galleries later on without cluttering the screen with a whole bunch of buttons.
here's the code...
PHP Code:
function loadXML(loaded) { if (loaded) { xmlNode = this.firstChild; image = []; description = []; thumbnails = []; total = xmlNode.childNodes.length; for (i=0; i<total; i++) { image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue; description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue; thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue; thumbnails_fn(i); } firstImage(); } else { content = "file not loaded!"; }}xmlData = new XML();xmlData.ignoreWhite = true;xmlData.onLoad = loadXML;xmlData.load("images1.xml");gallery_txt.text = "Gallery 1";// gallery buttonsbtngal1. onRelease = function(){ xmlData.onLoad = loadXML; xmlData.load("images1.xml"); gallery_txt.text = "Gallery 1"; thumbnail_mc.unloadMovie(); p = 0; thumbnail_mc._x = +1;}btngal2. onRelease = function(){ xmlData.onLoad = loadXML; xmlData.load("images2.xml"); gallery_txt.text = "Gallery 2"; thumbnail_mc.unloadMovie(); p = 0; thumbnail_mc._x = +1;}btngal3. onRelease = function(){ xmlData.onLoad = loadXML; xmlData.load("images3.xml"); gallery_txt.text = "Gallery 3"; thumbnail_mc.unloadMovie(); p = 0; thumbnail_mc._x = +1;}///////////////////////////////////// listen = new Object();listen.onKeyDown = function() { if (Key.getCode() == Key.LEFT) { prevImage(); } else if (Key.getCode() == Key.RIGHT) { nextImage(); }};Key.addListener(listen);previous_btn.onRelease = function() { prevImage();};next_btn.onRelease = function() { nextImage();};///////////////////////////////////// p = 0;this.onEnterFrame = function() { filesize = picture.getBytesTotal(); loaded = picture.getBytesLoaded(); preloader._visible = true; if (loaded != filesize) { preloader.preload_bar._xscale = 100*loaded/filesize; preloader.loadText = Math.round(100*loaded/filesize)+"%"; } else { preloader._visible = false; if (picture._alpha<100) { picture._alpha += 10; } }};function nextImage() { if (p<(total-1)) { p++; if (loaded == filesize) { picture._alpha = 0; picture.loadMovie(image[p], 1); desc_txt.text = description[p]; picture_num(); } }}function prevImage() { if (p>0) { p--; picture._alpha = 0; picture.loadMovie(image[p], 1); desc_txt.text = description[p]; picture_num(); }}function firstImage() { if (loaded == filesize) { picture._alpha = 0; picture.loadMovie(image[0], 1); desc_txt.text = description[0]; picture_num(); }}function picture_num() { current_pos = p+1; pos_txt.text = current_pos+" of "+total;}function thumbNailScroller() { // thumbnail code! this.createEmptyMovieClip("tscroller", 1000); scroll_speed = 30; tscroller.onEnterFrame = function() { if ((this._ymouse>=thumbnail_mc._y) && (this._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) { if ((this._xmouse>=(hit_right._x-3)) && (thumbnail_mc.hitTest(hit_right))) { thumbnail_mc._x -= scroll_speed; } else if ((this._xmouse<=30) && (thumbnail_mc.hitTest(hit_left))) { thumbnail_mc._x += scroll_speed; } } else { delete tscroller.onEnterFrame; } }; } function thumbnails_fn(k) { thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth()); tlistener = new Object(); tlistener.onLoadInit = function(target_mc) { target_mc._x = hit_left._x+(eval("thumbnail_mc.t"+k)._width+5)*k; target_mc.pictureValue = k; target_mc.onRelease = function() { p = this.pictureValue-1; nextImage(); };target_mc._alpha = 50;target_mc.onRollOver = function() { this._alpha = 200; thumbNailScroller(); }; target_mc.onRollOut = function() { this._alpha = 50; };}; image_mcl = new MovieClipLoader(); image_mcl.addListener(tlistener); image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k); } stop();
Thanks
Creating Animated Buttons Tut-Linking The Buttons To Content
I followed Lee's excellent tut on creating buttons using movies clips.
I am rather confused as to how the buttons can be linked to content -
ie Portfolio button to portfolio page - Contact button to contact page.
Im rather new to flash 8 however from my understanding of MX2004 I know
how to create a behaviour on a button symbol to play a certain page. After playing about with Flash this evening I was unable to get any button created using the tut to link to another page.
Can someone point me in the right direction, code or otherwise.
Thanks
Chris
Mx04: Any Idea How To Deal With Buttons On Top Of Buttons?
Hello fellow flashers.
Just a quickie hopefully; i have a rollover mc that when rolls over darkens a banner and as such shows the text more clearly when the mouse rolls over it (when its not rolled over you can see the pic clearer unedrneath) anyway ontop of this rollover mc i have a button now when you roll over that button the mc dissapears as if you've rollout of it again because the button is obviuosly taking priority.
Here's the question: Is there any way of getting both the mc to play its role and the button to have its over state at the same time?
dean!!
Rotating Menu Buttons On One Of The Buttons Press
This is a really simple question but one which i can't seem to find an answer for...
I'm trying to do something like the nav menu at www.echoprojects.com. I've done like half of it now but i got 2 questions:
I'm spinning a basic menu with 2D circles using _rotation and the tween and transition class, with easing. Now thats no problem, but I need to get the rotation rotating at different angles depending on which button is pressed. I can do the angles part....but i can't seem to find a way how to rotate the buttons at the angles depending on which button is pressed. I cant even tween a single button when that is pressed. I tried variables functions actions on different keyframe and on the actual buttons....but to no avail lol.
Another more offtopic to AS question is so far I've worked simply with 2D buttons and stuff. If anyone can point me in the right direction to get it working with 3D stuff, then that would be greatly appreciated.
Thanks, esurio.
Edit: oops, forgot i got an example file somewhere lol....see attatchment
Making MC Objects With Embedded Buttons Act As Buttons?
Hello everyone, thanks for reading my post.
I'm working on a map 'thumbnail' interface, with about two-dozen thumbnails that get larger (gotoandStop 5) on mouseover.
Now, this is the code I am currently using to achieve this effect:
Code:
on (rollOver) {
gotoAndStop(5);
_root.x += 2;
_root.VARIABLE_MC_NAME.swapDepths(_root.x);
}
on (rollOut) {
gotoAndStop(1);
}
Where should I put the onClick getUrl piece? And how?
I don't understand if it should be part of this function or have its own function.
Thanks for looking at this, all comments and answers appreciated.
-Tim
|