[CS3][AS2] Combining Logical Operator && With Variables Defined By Radio Buttons
Okay, I have completely hit a wall. Here's what I'm after. I have two sets of radio buttons, each of which controls what loaded swf appears on stage. Then, depending on which button is clicked in group one and which button is clicked in group two, a third swf appears.I can access the value of each radio button, and I'm passing it into a variable (I think - the trace command works) but when I drop it all together into an if/else statement, no data is passed.Here's the code: ActionScript Code: //printArea is a movie clip on stage, which has dynamic mc's attached via codevar thisFront;//function for what happens when fronts radio buttons clicked frontListener = new Object();frontListener.click = function(evt) { var whichFront:String = evt.target.selection.label; switch (whichFront) { case "1" : loadImage(printArea.crossSection,"xsc/O5DM_standard.swf"); descriptionFront("Standard Front"); break; case "2" : loadImage(printArea.crossSection,"xsc/O5DM_2-5in_light.swf"); descriptionFront("2.5 inch extended front with light"); break; case "3" : loadImage(printArea.crossSection,"xsc/O5DM_5in_light.swf"); descriptionFront("5 inch extended front with light"); break; } trace(frontsGroup.getValue());//thisFront is the variable created above thisFront = frontsGroup.getValue();// and this trace tells me the value assigned to the variable trace(thisFront);};frontsGroup.addEventListener("click",frontListener);frontsGroup.setValue("0");var thisLength;//function for what happens when lengths radio buttons clickedlengthListener = new Object();lengthListener.click = function(evt) { var whichLength:String = evt.target.selection.label; switch (whichLength) { case "1" : loadImage(printArea.footprint,"lengths/o5dm_4ft.swf"); descriptionLength("4 foot length"); break; case "2" : loadImage(printArea.footprint,"lengths/o5dm_6ft.swf"); descriptionLength("6 foot length"); break; } trace(lengthsGroup.getValue()); thisLength = lengthsGroup.getValue(); trace(thisLength);};lengthsGroup.addEventListener("click",lengthListener);lengthsGroup.setValue("0");//this part doesn't work. I can't figure out why//thisFront and thisLength are variables assigned in the above functionsif (thisFront == "1" && thisLength == "1") { loadImage(printArea.energyData,"data/O5DM_standard_4ft.swf");} else if (thisFront == "1" && thisLength == "2") { loadImage(printArea.energyData,"data/O5DM_standard_6ft.swf");} Thanks as always for any help.
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 08-07-2008, 01:43 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Using Variables, Logical &&, If/else And Radio Button Components
Okay, I have completely hit a wall. Here's what I'm after. I have two sets of radio buttons, each of which controls what loaded swf appears on stage. Then, depending on which button is clicked in group one and which button is clicked in group two, a third swf appears. This also needs to change according to user interaction.
I can access the value of each radio button, and I'm passing it into a variable (I think - the trace command works) but when I drop it all together into an if/else statement, no data is passed.
At first I had my if/else statements in a function, and that didn't work. I am so stuck. Good thing I'm bald or I'd have pulled all my hair out.
thanks in advance for any and all help! Any help would be greatly appreciated.
Attach Code
//printArea is a movie clip on stage, which has dynamic mc's attached via code
var thisFront;
//function for what happens when fronts radio buttons clicked
frontListener = new Object();
frontListener.click = function(evt) {
var whichFront:String = evt.target.selection.label;
switch (whichFront) {
case "1" :
loadImage(printArea.crossSection,"xsc/O5DM_standard.swf");
descriptionFront("Standard Front");
break;
case "2" :
loadImage(printArea.crossSection,"xsc/O5DM_2-5in_light.swf");
descriptionFront("2.5 inch extended front with light");
break;
case "3" :
loadImage(printArea.crossSection,"xsc/O5DM_5in_light.swf");
descriptionFront("5 inch extended front with light");
break;
}
trace(frontsGroup.getValue());
//thisFront is the variable created above
thisFront = frontsGroup.getValue();
// and this trace tells me the value assigned to the variable
trace(thisFront);
};
frontsGroup.addEventListener("click",frontListener);
frontsGroup.setValue("0");
var thisLength;
//function for what happens when lengths radio buttons clicked
lengthListener = new Object();
lengthListener.click = function(evt) {
var whichLength:String = evt.target.selection.label;
switch (whichLength) {
case "1" :
loadImage(printArea.footprint,"lengths/o5dm_4ft.swf");
descriptionLength("4 foot length");
break;
case "2" :
loadImage(printArea.footprint,"lengths/o5dm_6ft.swf");
descriptionLength("6 foot length");
break;
}
trace(lengthsGroup.getValue());
thisLength = lengthsGroup.getValue();
trace(thisLength);
};
lengthsGroup.addEventListener("click",lengthListener);
lengthsGroup.setValue("0");
//this part doesn't work. I can't figure out why
//thisFront and thisLength are variables assigned in the above functions
if (thisFront == "1" && thisLength == "1") {
loadImage(printArea.energyData,"data/O5DM_standard_4ft.swf");
} else if (thisFront == "1" && thisLength == "2") {
loadImage(printArea.energyData,"data/O5DM_standard_6ft.swf");
}
Logical Operator Problem
ActionScript Code:
work_mc.onRelease = function():Void{
if (this._y == 442.4 && firm_mc._y == 403.4){
trace ("yes");
}
};
Can someone tell me why this isn't working? The movieclips are at the correct y coordinates and will output when I try them on their own. Am I using the incorrect syntax for && or ==?
Logical Operator Problem
Code:
work_mc.onRelease = function():Void{
if (this._y == 442.4 && firm_mc._y == 403.4){
trace ("yes");
}
};
Can someone tell me why this isn't working? The movieclips are at the correct y coordinates and will output when I try them on their own. Am I using the incorrect syntax for && or ==?
Toggle Button Using The Logical Not Operator
I'm on page 583 of the best ActionScripting book I've ever seen (and I have 5 or 6 of them): Flash MX AS "Training from the source" by Franklin and Makar.
I've done every tutorial exercise in this book--no problem, ... til now.
On page 583 they have a button to turn off (actually toggle) a multi-banner-loading movie and they coded it like this:
on(release) {
_level1._visible = !_level1._visible;
bannerBack._visible = !bannerBack._visible;
}
If I click the button while the banners are loading, the present one will stop but then, after a slight delay, the sequence starts up again of it's own accord.
Am I missing something or is this failing? The authors imply it should stop the banners from showing (if they're currently loading) because "it's set up to control the movie loaded into Level 1 rather than a particular banner movie."
I tried to get Flash Help to help me but it's only sample for this "logical not operator" goes like this:
var happy:Boolean = false;
if (!happy) {
trace("don't worry, be happy"); //traces don't worry, be happy
}
and I'm not hip enough to see how it might aid in changing or understanding the book's code.
I tried searching this site and the web every which way but can't find any code to create a toggle button with the "not operator" that uses the explanation point.
Any ideas as to what's going on and what can or should be done in such a situation?
Logical Evaluation With Dynamic Operator
Hi, all.
I have a function that evaluate numeric values based on a dynamic operator.
Something like:
Code:
function ev(value1:uint, value2:uint, operator:String = ">")
{
return operator == ">" ? value1 > 2 : value1 < value2;
}
For performance improvement issues, I want to remove the first condition (operator == ">"). Is there a way? In AS2 I could use the eval, for example.
Thank you,
CaioToOn!
AS3 - Logical Evaluation With Dynamic Operator
Hi, all.
I have a function that evaluate numeric values based on a dynamic operator.
Something like:
Code:
function evaluate( value1:uint, value2:uint, operator:String = ">" )
{
return operator == ">" ? value1 > 2 : value1 < value2;
}
For performance improvement issues, I want to remove the first condition (operator == ">"). Is there a way? In AS2 I could use the eval, for example.
Thank you,
CaioToOn!
Crazy Foreign Logical Operator I've Stumbled Across
Hey guys,
I've been working with some source I found online for a scrolling menu, and I happened upon this little ditty I don't understand:
Code:
if (_x <- (width + 0.5 * (_root.pix_separate)))
{
_x = 0;
}
What's the "<-" operator about? I replaced it with the less-than-or-equal-to guy thinking the author mis-typed (even though it functions as it should), and that definitely was not the case as doing so did some pretty major damage (well, damage in so far as it didn't function at all). Could somebody with any kind of knowledge enlighten me?
Thanks,
TheRiddler
Flash Menu Buttons And User Defined Variables
Okay--maybe somebody can help me on this bugger. My brain is fried over it. I will email the fla file and a giant cookie to anyone who can help. I have two issues for a flash navigation menu that contraols a non-flash page:
1)I want to show the current page as "active" by altering the corresponding MC. I am trying to reference instance names of seprate mc's (totally seperate, not duplicates) in order to change their appearance according their state (active, as in the HTML page it is pointing to is active VS. inactive). I have 12 mcs named mc1-mc12. Each mc has a button inside. The code for the MC is:
Code:
onClipEvent (load) {
skal = 0;
}
OnClipEvent (enterFrame){
if (skal ==1){
_xscale = _xscale+(150-_xscale)/3;
_yscale = _yscale+(150-_yscale)/3;
}
if (skal ==0){
_xscale = _xscale+(100-_xscale)/10;
_yscale = _yscale+(100-_yscale)/10;
}
if (skal ==3){
_xscale = 150;
_yscale = 150;
}
}
The code for the button in the mc is:
Code:
1 on (rollOver, dragOver){
2 skal = 1;
3 }
4 on (rollOut, dragOut){
5 if (Active ==1){
6 skal = 3;
7 }else {
8 skal = 0;
9 }
10 }
11 on(release) {
12 Active = 1;
13 GetURL("help.htm","_self");
14 }
Basically, the buttons expand and contract as you roll over them and link to a specific URL. I would like to address the problem of indicating which page on the nav menu the user is currently visiting. My idea was to insert these lines between line 13 and 14 of the button:
Code:
tellTarget(mc1){
Active = 0;
}
//repeat for each button instance name
Each button would have to be addressed so that when you click on a button, it sets the variable "Active" to 1 for the button you clicked and 0 for the rest of the buttons.
Basically, the button is supposed to freeze at _xscale = 150 until another button on the menu is pressed.
It's not working. Is there a beter way to do this? I just want the button to stick out to make it pbvious that that is the page they are looking at.
2)My bigger problem arrose when I was told to nix the frames on the website. Now when a button is clicked, it goes to a new page with the same swf file on it, but it reloads the file. Is there a way to prevent reload and allow it to maintain it's state whil the even when the page changes?
The beginings of the menu are on (The page is in SERIOUS overhaul mode, so pardon the ugliness) this link still uses frames. I have not uploaded the non frames version yet, but the problem is easy to visualize...the movie retarts when you nav to a different page:
http://www.themitchellcentre.ab.ca/T...e/testpage.htm
Thanks for any help.
PS--I tried everything to make the individual buttons stick out, I tried making the text dymanic and chaniging the color, I tried stopping th emovie, I tried, all I could think of, but nothing worked while maintaining the rollover movement. Thanks.
http://www.taigraham.com
Email my personal account
Variables From Radio Buttons
I am trying to pass 2 variables from my flash movie to an asp page.
I have a text box that passes it's typed content to the web page just fine but I need to add a second parameter (to the querystring) that is one of two choices - therefore I am using two 'radio buttons'.
I cannot get this to work...
Could anyone point me in the right direction on this.
How do I set up a radio button group and make it pass a parameter=variable just like my text box currently does?
Cheers,
Rob
Sedning Variables From Radio Buttons
Hi Everyone
I’ve created a form using sradio buttons and php. If I push the send button without anything selected the response I receive has object Object] where the variable info is sent when that one is selected. Does anyone know why? Should I have one of the radio buttons selected by default?
Thanks
yeffer
Logical Operator "or"
Can't see the forest for the trees. I know I am overlooking something simple here but I can't seem to find it. I have an input field, an output field and a button. Here is my code:
on(release){
if(inputField == "lunchroom"||"lunch room"||"lunch-room"){
outputField = "Correct";
}
}
I am allowing the user to use different spellings of the word lunchroom. Only the first literal works in this code. Can someone tell me what I am doing wrong.
Thanks
Passing Radio Buttons Variables (asp Form)
Hi Girls,Guys,Gurus!,
My problem:
I'm trying to create an ASP form with 3 radio buttons(10,20,30 km)
using Flash 5.
First I don't know how to assign a variable to a radio button,and the other thing is how the asp form should
look like(mtext04 = "number of kilometers: " & Request.Form("check") & vbcrlf ?).
All I have seen so far is how to put a dot in a radio button
but nothing else.
Any help will be really appreciate!
Einstein:Only 15% of our intelligence used,and 85% for Flash!
Radio Buttons / Variables/ Email Form Values
Hi,
I am not very proficient in actionscript at all. I just managed to find a perl script i was able to configure to get the results of a little (test) form i made back to me (this took me a week 24/7 !!!)
anyway, there are four input text boxes with variables named name, email, zip, colour. They return the expected values. (yay)
However i have two radio buttons whch i called them both memberGroup (which had labels and data values of yes and no) and i dont jknow whats going on there???This is what my form emails me:
__________________________________________________
name: celia
zip: 12778
colour: blueish green
FRadioButtonGroupClass: [type Function]
memberGroup: [object Object]
FRadioButtonClass: [type Function]
email: niinn@nanna.com
FUIComponentClass: [type Function]
__________________________________________________
Ive searched and searched forums and read MM tutorials but cant understand what is happening.
Is anyone able to explain the following:
2)what is the variable names of components? is it memberGroup (for my above example)?
1)getValue & getData? How do i use these. Can anyone give me examples.
Basically, the above is all my form consists of.
Thanks in advance for anyones patience in explaining this to me and helping me here
Francesca
POST Variables - Contact Form With Radio Buttons
Greetings,
I found this same querry in an archived post but the solution was not provided so I will make my own post.
I have a basic contact form. It contains the standard name, email, subject, and comments boxes. When you click submit it POST variables to a PHP form and then forwards info to email address with the PHP form. Pretty basic stuff.
Now heres my problem. I have been asked to include selections within the contact form. I have determined that the use of labled radio buttons will do the job. Each button will have its own label and the user can simply check which button he likes and then fill out the rest of the form and hit submit.
Forever Indebted,
PHP Variables And Logical Functions
Hi there,
well i guess i got a stupid question but i cant figure it out
Code:
var zoeken:URLRequest = new URLRequest("http://www.zvcvegatigers.com/PHP/aanwezig.php");
var lader:URLLoader = new URLLoader();
lader.dataFormat = URLLoaderDataFormat.VARIABLES;
lader.load(zoeken);
lader.addEventListener(Event.COMPLETE, laden);
function laden (event:Event):void
{var karel_beslist:String = lader.data.dag2_10;
trace(lader.data.dag2_10);
trace(karel_beslist);
if (karel_beslist == "neen") {karel_mc_a.gotoAndStop(2);}
is use the as3 above to obtain values from a php page
by tracing i can confirm i receive the values properly.
BUT
when i use those values in a logical function they don't work
anyone sees a mistake in the code above ?
Cause i got an terrible headache from watching it for some time
Thanks in advance for thos trying to help,
Greetz to all
Storing Logical Operators In Variables
hey there,
Instead of writing out a conditio twice is it possible to pass the logical operators || or && through a variable?
Code:
a= true;
b = true;
c = operator || or &&
if (a c b) {
//
}
Is this even possible?
thanks,
ward
Dynamic Creation Of Radio Buttons In A Radio Button Group
Is there a way to dynamically add new radio buttons to a radioButtonGroup say from an xml file? I am looking for a similar functionality to what I would receive if I were to use a dataprovider for a comboBox (except I need to use radio buttons). Code samples are appreciated. Thanks
Combining Variables And The Like
Okay, I'm not even sure if this is possible, but I've been pulling my hair out. I know this is possible in other programming languages, but I'm far from an actionscript expert.
Okay, here's what I want. I want a button that when you roll over it, it generates a random number. Based on that random number, it then plays a random movie clip.
Here's what I've done so far:
I have a series of movie clips named a1,a2,a3...a55. I also have button that has the following script attached to it:
on (rollOver) {
_rooot.hit = random(60);
a1.play();
}
Now, obviously, when you rollover this button, it only affects the movie clip a1. How do I combine the varialbe "hit" with the object "a" to produce "a + hit"?
Thanks a bunch for any insight.
Combining Variables
Hi Flashers
I'm trying to get an action to occur when 2 variables(aim+straw) are present at the same time, I'm just not sure where the combined variable(hit ) go and how to write it, so that it works. Can anyone help?
eg
onClipEvent (enterFrame) {
if (_root["ship"].hitTest(_root["hit"])) {
hit = "aim+straw";
with (_root.aim.blast) {
gotoAndPlay("blast");
}
}
}
yeffer
[F8] Combining Variables
hopefully a simple solution will reveal itself....
I am trying to combine two variables to create the text variable to be displayed in a dynamic text field but for some reason I keep getting "undefined".
I have a function ("displayText();") that runs each time the user progresses to the next section, which should update my title for that section.
-------------------------
var sectionNum = 1;
function displayText() {
secTitle = _level0.s_title_;
title_mc.sectionTitle = secTitle[sectionNum];
-----------------------------
I have tried attaching the sectionNum var to the secTitle as well like this:
var sectionNum = 1;
function displayText() {
secTitle = _level0.s_title_[sectionNum];
title_mc.sectionTitle = secTitle;
------------------------------
It does actually display though when I run it like this:
var sectionNum = 1;
function displayText() {
secTitle = _level0.s_title_1;
title_mc.sectionTitle = secTitle;
//but that doesn't allow me to dynamically update the var secTitle
//by simply concatenating the var sectionNum to it
LoadMovie Using Defined Variables
Here's what I'm trying to do... I have two vars: picturefolder and picturenumber. I'm using this for a type of slideshow picture gallery while dynamically loading the images. Let's say the picturefolder var = "hawaii". If the user clicks "next picture" while looking at "hawaii/1.jpg", I want it to load "hawaii/2.jpg" and add 1 to picturenumber. This is what I have, and it isn't working..
Code:
on(press){
_root.top.picture.loadMovie(_root.picturefolder+"/"+_root.picturenumber+1+".jpg");
_root.picturenumber = _root.picturenumber+1;
}
But instead of adding 1 to the picturenumber var, it actually adds a "1" to the image. Instead of going to 2.jpg, it goes to 11.jpg. then it goes to 111.jpg. How in the world do I just add 1 to the actual number?
ReferenceError: Though The Variables Have Been Defined
Scenario:
Cairngorm framework used.
The Application loads different modules at runtime on user selection.
The Application and each of the modules has a seperate front controller.
One of the module it loads is using getDefinitionByName()[In the command through the controller] to instantiate an object at runtime. The class it is trying to instantiate has been imported along with other dynamically instantiable classes in a seperate AS named ClassDeclarations.
This ClassDeclaration is instantiated at the Module so that the references of the dynamic classes are available and compiler includes the same in the swf.
Problem:
But this doesnt work. It gives an
Quote:
ReferenceError: Error #1065: Variable XXX is not defined.
at global/flash.utils::getDefinitionByName()
at...
Observations:
1. Now if the same ClassDeclarations are instantiated at the Application level, the one which loads the module, it magically works.
2. When the module is loaded, and the event is dispatched, the front controller of the module is able to route the event to its command properly.
Questions:
I wonder why? and what is the difference it makes to put the ClassDeclarations at Application level than at the module level? Since the classes in ClassDeclaration are used only by the module, it is not making sense to to put it at the Application level and increase the App size.
User Defined Variables
help?
i was wonderin: is there a way to make a flash movie where the user defines the text variables? I am using flash 5, and think this will be a REALLY simple thing 2 do, but im a newbie
any help will be greatly appreciated
[proto] Defined Variables?
Code:
MovieClip.prototype.floatTo = function(s, x) {
this.onEnterFrame = function() {
this.floating = true;
x_vector = Math.floor(((x-this._x)*s)*s);
if (x_vector == 0) {
this.floating = false;
this._x = x;
delete this.onEnterFrame;
}
this._x += x_vector;
};
};
//
//
//Creates the prototype resizeTo
MovieClip.prototype.resizeTo = function(s, w, x) {
this.onEnterFrame = function() {
this.resizing = true;
w_vector = Math.floor(((w-this._width)*s)*s);
x_vector = Math.floor(((x-this._x)*s)*s);
if (x_vector == 0 && w_vector == 0) {
this.resizing = false;
this._width = w;
this._x = x;
delete this.onEnterFrame;
}
this._width += w_vector;
this._x += x_vector;
};
};
MovieClip.prototype.restageTo = function(s, w, x) {
this._width += (Math.round(w-this._width)*s)*s;
this._x += (Math.round(x-this._x)*s)*s;
};
//
//
basically some of this code moves stuff around
i do not understand though because a lot of variables are not defined...
LIke I see X and S and W aren't defined but being used for subtraction
Combining Strings And Variables...
I'm having a real problem with this, any help would be appreciated.
basically, I'm trying to load a random movie. files are named loop1.swf, loop2.swf...loop6.swf. In my first frame of my main movie, I do the following:
randloop = random(6) + 1;
LoadMovieNum = ("loop" + randloop + ".swf", 1);
Now, in theory, that should work.. but for some reason, it's not appending the "loop" and ".swf" strings to the randloop variable, and it's basically trying to load files 1, 2, 3, 4, 5 or 6 with no loop precursor or .swf extension.
Any idea what I'm doing wrong? I'm authoring in Flash 5 but exporting as Flash 4, hence the flash 4 operators but the FLash 5 LoadMovieNum call... also, yes, the values are set as expressions...
thanks!
Combining Variables - I'm Stupid
Check this out, I've tried every combination I can think of.. but here's the simple problem
hello5 = 666;
b = 5;
test = "hello" + b;
I'm trying to get the var 'Test' to equal 666. I either get it to equal "hello5" or nothing at all. I've tried 'add' instead of +, i've tried using Set, changing around expressions. I just feel i'm forgetting something small.
Please don't write a reply unless you try the above, and are able to get hello5 equal to 666.
-J
Combining Strings As Variables
Well, I've been trying for hours to get this to work and I think I could use some help. I am trying to combine two strings to create a dynamic variable, for example, "myOutline = outline + 1". However, when I attempt to use this name("myOutline._alpha = 0") to call a movie clip called "outline1" it won't work. It doesn't seem to recognize the combined name that I've created as a variable, it just uses it verbatim ("myOutline._alpha = 0" instead of "outline1._alpha = 0"). This seems like it should be a common enough task, but I'm having a terrible time trying to figure out an acceptable syntax. Any assistance could mean a better nights rest.
Thanks, Joseph
Combining Variables To Display
i have this bit of code:
_root.varMinute = "var4_Anytime"+"var4_Nights"+"var4_MTM"+"var4_Fami ly"+"var4_Share"
it is combining variables loaded from an asp page to display them on the flash page in a dynamic text field. they all show up, but the formatting is back to back to back. no spaces. how can i get soem commas in there or at least some space? thanks.
Combining Variables To Display
i am using this code to combine some variables to display in a dynamic text field:
_root.varFeatures = "var5_voice"+", "+"var5_mobile"+", "+"var5_im"+", "+"var5_national"+", "+"var5_other"
i have this code sitting on the main timeline.
the variables do not come thru tho, just their name. so when it displays, the values are not shown, just the names. i know the variables are sitting on the root waiting to be taken up. what is wrong with this set up?
Combining Two Text Variables Into One?
I have two variables defined by XML with the following script:
ActionScript Code:
stop();
var xmlData:XML = new XML();
_level0.homeMC.quoteMC.xmlData.ignoreWhite = true;
_level0.homeMC.quoteMC.xmlData.load("quotes.xml");
_level0.homeMC.quoteMC.xmlData.onLoad = function():Void {
total = this.firstChild.childNodes.length;
i = random(total);
quotePath = this.firstChild.childNodes[i];
quoteText = quotePath.firstChild.firstChild;
quoteAuthor = quotePath.firstChild.nextSibling.firstChild;
quoteMessage.text = quoteText+quoteAuthor;
};
The general idea is to randomly generate a quote text and author, both from the same quote and then combine them into one string to be applied to a text box. Now, I've traced both "quoteText" and "quoteAuthor" and if I add ".text" to the end of each one the proper information comes up. I have also traced quoteMessage.text as equalling quoteText or quoteAuthor, like as seen above. When it's one or the other the text shows up, but when I try to combine them it doesn't seem to work.
Am not too sure what I'm doing wrong but I know the problem is in the second to last line. Does anyone know how to fix my problem?
Combining/converting Variables
I am having a bit of trouble combining variables.
I have a dynamic text field that I am using to show which picture is displayed. When you click on a "next picture" button, I increase the variable piccount with one. picCap stays the same as it represents the total number of pictures in that section. (see code)
My dynamic text field is called piccount.
I am loading the names of the corresponding pictures with loadvars into a variable called loadText. My text file looks like this:
&pic1=Building 1
&pic2=Building 2
&pic3=Building 3
The variables in the text file are being loaded properly as the following code displays the following in my textfield: 1/3 Building 1
ActionScript Code:
_root.piccount.text = (picnumber+" / "+picCap+" "+loadText.pic1);
However I can't seem to get the correct info for the correct picture as the above code obviously displays "building 1" for each picture. I have tried a bunch of different options like combining the variables but can't get it quite right.
Can someone help me display the correct text for each picture?
Combining/converting Variables
I am having a bit of trouble combining variables.
I have a dynamic text field that I am using to show which picture is displayed. When you click on a "next picture" button, I increase the variable piccount with one. picCap stays the same as it represents the total number of pictures in that section. (see code)
My dynamic text field is called piccount.
I am loading the names of the corresponding pictures with loadvars into a variable called loadText. My text file looks like this:
&pic1=Building 1
&pic2=Building 2
&pic3=Building 3
The variables in the text file are being loaded properly as the following code displays the following in my textfield: 1/3 Building 1
ActionScript Code:
_root.piccount.text = (picnumber+" / "+picCap+" "+loadText.pic1);
However I can't seem to get the correct info for the correct picture as the above code obviously displays "building 1" for each picture. I have tried a bunch of different options like combining the variables but can't get it quite right.
Can someone help me display the correct text for each picture?
Variables Returning 'true' And Not As Defined
I have five buttons with the following code:
on (release) {
_root.backgraphic = "about";
}
(each button sets the variable to a different section, i.e., about, contact, home etc.)
I then have 'if' statements scattered throughout my movie that check for this 'backgraphic' variable like the following:
if (_root.backgraphic == "home") {
gotoAndPlay("home");
} else if (_root.backgraphic == "work") {
gotoAndPlay("work");
} else if (_root.backgraphic == "contact") {
gotoAndPlay("contact");
} else if (_root.backgraphic == "extras") {
gotoAndPlay("extras");
} else if (_root.backgraphic == "about") {
gotoAndPlay("about");
}
The movie works fine sometimes, but after clicking and changing the variable a couple of times, the variable becomes equaled to 'true', and then my 'if' statements get all screwed up.
My question is why does my variable just seem to change to 'true' out of the blue?
Any help would be greatly appreciated. Thanks so much. --Dan
Loading Externally Defined Variables
Hi all,
So I've made a slideshow for a client that calls externally loaded images, and when those images are loaded into the frame that calls them, an invisible button that is placed over the image calls a url. I was wondering if there is a way to have the getURL function i'm using for url calling could be set to a variable, and have that variable be defined in an external text file. This way, the client could edit the url called by editing this text file, as opposed to editing the flash, which would be a disaster if left up to the client. Any ideas? Thanks
Best Way To Check If Variables Values Are Defined
This is what I'm using. it's not working. why not?
Code:
if (firstName != "" || lastName != "" || address1 != "" || city != "" || state != "" || zip != "" || emalAddress != "" || phone != ""){
trace(fieldClip.firstName +" "+fieldClip.lastName +" "+fieldClip.address1+" "+fieldClip.address2+" "+fieldClip.city+" "+fieldClip.state+" "+fieldClip.zip+" "+fieldClip.emailAddress+" "+fieldClip.phone);
this.gotoAndStop("step2");
}else{
this.gotoAndPlay("error");
}
Combining Variables And HTML Tags
I have a dynamic text link in my flash movie that I am creating with an html formatted dynamic text field.
i.e
KA_Link1_URL = "asfunction:_level0.Load_Link1";
KA_Link1_Text = "<B><A HREF="" + KA_Link1_URL + "">" + KA_Link1_Title + "</A></B>"
This works fine!
Now I want to make the text center justified and so have tried adding an alignment tag as follows:
KA_Link1_Text = "<P ALIGN="CENTER><B><A HREF="" + KA_Link1_URL + "">" + KA_Link1_Title + "</A></B>"
This is now giving me a syntax error!!!!!
On macromedia technote (http://www.macromedia.com/support/flash/ts/documents/htmltext.htm) it says:
Use a <P> tag to right-align the text. In the Value field of the Set Variable action, modify the existing HTML string with the following:
It also says :If no ALIGN attribute is specified within the <P> tag, the paragraph alignment defaults to that specified in the Paragraph panel for that text field.
I have specified center justification for my text field and it is still appearing as left justified. I have tried everything to get the damn text center justified - has anyone any idea or can tell me where I am going wrong????
Thanks
Chucky
Combining Multiple POST/Variables
i need help combining the two post options i have vidData.sendAndLoad("upload.php",vidData,"POST"); and file_fr.upload("upload.php"); flash will not process both separate how would i go about combining them so my loadVars and file uploads and post
PHP Code:
upload_butn.clickHandler = function(){
vidData = new LoadVars();
vidData.vname = vname.text;
vidData.vdesc = vdesc.text;
vidData.sendAndLoad("upload.php",vidData,"POST");
file_fr.upload("upload.php");
rec_mc.fillColor = Math.random()*0x1000000;
info_txt.text = "Upload Started... Do not close broswer.";
upload_butn.enabled = false;
}
Combining 2 Variables To Form A Variable Name?
Hey guys, i am in desperate need of help
I have this variable on my root timeline
_root.profileURL1 = "profile.php?id"+_root.id
The above vorks fine
Now in a movieclip i have a button with this action on it
Code:
on (release) {
getURL([_root.profileURL+_root.count], "_self");
}
Now count is a variable 1 trough 55
And depending on what that is i'd like to get the url of
_root.profileURL1
_root.profileURL2
_root.profileURL3
ect....
But it seems to want to combine the undefined variable of _root.profileURL with the number of _root.count
Can anyone help me please?
I appriciate your time
Thank you
~Gabor
Combining Variables - Prob. Lame
been on holiday for 2 weeks and I think i lost some brain cells while coming back.... cause i just can't make it work
I have a text file with different variables e.g.
variable1
variable2
variable3
In my SWF i want to load the variables:
Code:
loadVariables ("text.txt", "");
I want to show a random variable in a textfield:
Code:
//the amount of variables
numVars = 3;
//getting a random number back
vizNum = int(Math.random()*numVars)+1;
//setting the textfiled
mcVar.TheVar = "variable"+vizNum;
I do get the correct variables back, but it seems to treat it as text in stead of an expression.
How can i solve this? I also tried with new String() - but no successs.
Help.
==
Giraffe
Accessing Variables From An Externally-Defined XML File
Hi All-
So, I'm starting to jump onto the AS3 bandwagon, and have been studying this for a couple of weeks now... and what a ride it's been already!
As an exercise, I'm trying to put together an XML parser. Everything works perfectly for my needs if I use:
ActionScript Code:
xmlLoader.load(new URLRequest("someXML.xml"));
However, if I define "xmlURL", below, with SWFObject's addVariable, I have no idea how to access the XML data on the "global" timeline:
ActionScript Code:
xmlLoader.load(new URLRequest(xmlURL));
In AS2, accessing this would have been easy, since it would then become a root variable, but now that AS3 has no globals, I'm at a loss. From what I gather, I'm supposed to use loaderInfo? I've found several tutorials but they all seem to come up with "undefined blah blah blah". Please help, this is killing me!
Aside form this, I'm liking AS3!
Accessing Variables Defined In Document Class
I am having trouble assessing values established in my document class.
My document class: ZoneViewer.as:
public class ZoneViewer extends Sprite {
private var zone_area_alpha_low:Number=.2;
}
This code exists on a frame within a movieclip on my main timeline:
this.zone_shape.alpha = zone_area_alpha_low;
How do I access the .2 value which is declared in my document class:ZoneViewer.as? "zone_area_alpha_low" is not working.
Can I Resize A Flash Movie To User Defined Variables?
Hi Everybody,
I'm using Flash MX. I'm looking for a way to resize a flash movie from within flash, using a X and Y variable. So far I can figure out how to scale a movie to fit a screen, but not to a specific number. Anyone have any idea as to how I would go about doing this?
-Plasnid
Accessing User Defined Variables In A Text File...
I have a text file (let's call it "test.txt") which has a string of variables and their corresponding values. In my flash application, I have a TextInput component for a user to type their name, and a ComboBox component for the user to choose a value.
I want to be able to use the name the user typed in to jump to the variable in the test.txt file and modify its corresponding value.
I figured something like this would work:
code:
var result_lv:LoadVars = new LoadVars();
var login_lv:LoadVars = new LoadVars();
login_lv.username_ti.text = combobox.value;
login_lv.sendAndLoad("test.txt", result_lv, "POST");
However, the big problem is, it doesn't seem to like "login_lv.username_ti.text" -- using 'trace', it's always showing up as undefined.
Basically, if the user types 'Bob' as his name, I want to modify login_lv.Bob, but I don't want to have to do this with a whole bunch of 'IF' statements. Is there something I'm missing, or is there a better way to do this altogether?
Thanks!
-Tom
Error 1120 When Superclass Variables Aren't Defined
Hi,
I've simplified the problem but basically i have two files: parent.fla and child.fla.
Parent.fla will load child.fla and display it.
parent.fla has its own class definition of type ParentClass and is basically defined as below..
public class ParentClass extends MovieClip
{
public function AddListener()
{
btnOnStage.addEventListener(MouseEvent.CLICK, SomeMethod);
}
}
it also has a button on the stage called btnOnStage.
the child .fla has nothing in it but it's class definition is..
public class ChildClass extends MovieClip
{
public function DoSomething()
{
var pc:ParentClass = parent as ParentClass;
}
}
These classes all have the relevant imports etc so there's no compilation errors.
But when i try to publish the child.fla i get the error saying..
1120: Access of undefined property btnOnStage
my work around at the moment is just putting in var btnOnStage:SimpleButton; into the ParentObject class which lets it publish the child.fla fine, but it obviously causes conflicts when i publish the parent.fla as btnOnStage already exists.
I know i get this error when publishing the child.fla because basically the object is on the timeline in the parent.fla and is being accessed from the parent class and has never been defined. But how do i get around this? Is there a way to tell flash that there will be a variable like that there and dont worry bout it?
thanks,
[MX04] Combining Strings And Variables To Make Names
How do I combine a string with a variable to call the name of an object?
For example, say that I am attaching a blocks to the root time line every time the mouse is clicked. I will name the clip like this:
Code:
attachMovie("blockID", "block" + i, i)
i = i + 1;
Now say that I want to control the X Position of the block, how do I do that?
["block" + i - 1]._x doesnt work.
|