ActionScript 3.0 :: Check Inputfield With If Statement?
Jun 10, 2011
I have the following code.
Code:
var codes_txt;
locatie_mc.visible = false;
check_mc.visible = false;[code]....
When someone enters text in the inputfield (Instancename= codes_txt) it has to be checked.
If it is good(GoedeCode) kaarten_mc has to go to the next frame.
If it isn't good(FouteCode) kaarten_mc has to go to the previous frame.
If the code does not excist they have to get an error: code does not excist.
It has to start checking after the function CheckCode.
Now I don't know how to check the inputfield. In theory I know what to do but I don't know how to put it into AS3.
View 1 Replies
Similar Posts:
Jun 9, 2011
I am trying to use a mouseevent.startdrag to move a particular movieclip, but I don't know how to go about checking the object in question. The code below doesn't seem to work with either ==Object(MCsquare) or just ==MCsquare.
function onStartDrag(evt:MouseEvent):void
{
trace(evt.target);
[Code]....
How can I run a check to see if the target object is MCsquare?
View 2 Replies
Sep 25, 2009
i am trying to find out if it is possible to check on more than one variable in an if statement at a time as i am usure how, so is it possible in as2 to check on more than one varialble if answer is equal to the number 1 and answer is to the number two and also the number three perform a function
var answer1:Number =1;
var answer2:Number =2;
var answer3:Number =3;
if(answer == 1 ) and answer == 2 and answer ==3);
if(answer == 1 and answer == 2)
View 3 Replies
Jun 29, 2004
The user needs to submit a dollar amount answer. They could write is several ways. I'm trying to accomodate it with the code below. It always evaluates it as the wrong answer (the else).
[Code].....
View 4 Replies
Aug 28, 2011
i want my if statement to check if boolean is true so here is my code.
name:Boolean = new Boolean();
mc1.addEventListener(MouseEvent.CLICK, myMouseEvent);function myMouseEvent(event:MouseEvent):void{ name:Boolean = true; if(name:Boolean = true) { //code to run....
}
Syntax error:expecting right paren before colon.
probably a simple explanation that i cannot this of.
View 3 Replies
Feb 23, 2010
checking an XML file for a specific node.
Example:
<vid
flv="videoName"
thumb="thumbnail.jpg"
title="Video Title"
[code]....
The first vid node contains a path to a logo graphic, I then need to check in my ActionScript if there is a logo there or not, and to do something if there is(display the logo) I can trace out the logo path so I thought I could run a simple if/else to check if there is anything in that node and if so to do something:
private function thumbOver(e:MouseEvent = null):void
{
trace("
");
[code]....
Now I've tried everything, but it will always trace out "Does have a logo" no matter what I do. I tried:
if (tabData[tabID].video[e.target.id].@logo == "")
if (tabData[tabID].video[e.target.id].@logo == null)
However I get the same results?
View 1 Replies
Oct 24, 2011
Just starting to delve into as3. I have made a flash website with four navigation buttons (home, products, about, contact). When user clicks on "products", an external movie clip is loaded and everything works fine. User clicks any button after that, and myLoader.unloadAndStop, the swf is removed when you navigate away from "products". However, if the "home", "about", or "contact" buttons are clicked first (before the external swf has been loaded), it of course, throws the 1009 error.I need some sort of if/else statement to check whether or not the external swf is loaded, remove it if it is, and if not, just navigate to the "page" clicked.[code]
View 0 Replies
Apr 1, 2007
I'm trying to write an if statement so that when the user clicks on my button i tween some content in.
Here is my AS Code:
ActionScript Code:
if (news.onRelease == true){
function newsContent(){
[Code]....
View 3 Replies
Sep 27, 2010
I'm trying to check to see if an object exists by using a simple if statement.
if (object.name) {
//Do this
}
However, if the object doesn't exist, I get this error, "Error #1010: A term is undefined and has no properties" - which I understand is because the object doesn't exist. Is there a better way to check to see if an object exists?
View 1 Replies
Jun 11, 2010
In a setup like this is it possible to check the cumulative status of all onLoadInit?
for(var i:Number = 0; i < limit; i++) {
var mcLoader:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadInit = function(mc:MovieClip) {
[Code]....
Initially I was thinking that I could pass an array of Boolean's, but I'm not really sure where to add that checkpoint, because a flash frame doesn't keep looping. Would I have to add it to an onEnterFrame()?
View 1 Replies
Jun 3, 2004
I want to check if an input text field is empty. I only managed to do it this way;
mytext = textfield.text;
if(mytext != "") .....
The problem with this approach is that I also want to exclude variables with whitespaces.
I tried; if(!isEmpty(mytext) )..... but that didnt work.
View 11 Replies
Jan 24, 2007
i basically keep tracing the variable name and not the value of the variable.
class temp{
private var myVariable:String;
private var formClip:MovieClip;
public function temp(myClip:MovieClip){
[URL]..
keeps giving me the name of the variable and not the contents of the variable. I'm trying to make it so when i type something in the textfield, i an trach myVariable and it'll give me the contents.
View 1 Replies
Nov 29, 2006
-I have an inputfield (input)
-submitbutton (button)
-and a textfield (tekstVeld)
what i want: fill in a number->press button-> (number*1) (number*2)... etc. for example: 6->press button->0,6,12,18,24,30,36,42,48,54,60
[Code]...
That doesn't work. But i when i change Number(input.text); to Number(6); for an example it works. But i want an number by input
View 7 Replies
Nov 15, 2007
I have an input field that when it's accessed for the second time by an user i want it to erase it's content automaticaly so the user can't see what he previously inserted. I want this to work on EnterFrame if it's ok.
View 2 Replies
Mar 18, 2012
how can I save formatted text in flash and maintain style(ie color, size, bold, italics) example:
in the input field I write something, then i make it bold, and blue. I would like to save this text in the edited form of bold and blue. how do I save that text FORMATED to a variable.
View 3 Replies
Jun 24, 2004
i'm trying to use if statements but can't get this thing to work i want to check if another button is visible on release of a button to determine what action to be taken.the 'gotoAndPlay("firstscene",1)' is just there as an outcome, will be changed later. anyway this is the code i've got on the button i'm pressing. blobyellow2 is an instance of a button blobyellow is it because it's an instance that it's not working?
[Code]...
edit: sorry forgot to put what's wrong with the code. it acts as though the statement is correct no matter if it is or isn't.
View 11 Replies
Mar 15, 2011
i have "roll over" event listener and i would like to that works only with MovieClips (without textfields etc.). I would like to write something like that:
if(event.target == MovieClip){ do something }
else { do something else}
This doesn`t work properly.
How to check type of event.target in "if" statement?
View 1 Replies
Apr 5, 2005
I have 'Sound On' and 'Sound Off' buttons on mutiple scenes and I am playing the music loop in my flash movie by loading an external swf. When I move to the next scene the sound reloads which I do not want. How do I use an if-statement that checks whether or not the music.swf, that needs to be loaded is found and when it is found, go to a frame?
View 1 Replies
May 14, 2009
Having a few problems with what I thought was a simple if statement. Here is the code:
[Code]...
I can't quite figure out the small problem with the code. It seems to just bypass the first requirement of the if statement when I do type in the proper input and go straight to the else statement.
View 7 Replies
Aug 31, 2011
if (variable == 1){
//code
//Execute this code.
} else if (variable == 2) {
//code
[Code]...
I dont want to copy the code from the first into the second and the first and second into the third.
My mind isn't working and there is probably an extremelly simple way to get this working.
I know I could used functions but for some reason it stops the instance referencing working: _root["bullet"+j] doesnt work in a function.
View 7 Replies
Oct 10, 2008
The Flash movie contains 2 Text files, one Component button, and 1 component checkbox.The purpose of the application is to load an XML file(works)Populate 2 text fields with information from the XML file(works)Compare the two text fields, if they contain the same information then the checkbox, via AS is told to be selected. (Heres the problem);
Heres the code:
Code:
runCode_btn.onPress = function() {
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function(success) {
[code]....
The idea behind this app is that its an electronic form. The user fills it out, the information is then sent to a newly created XML file, months later the open the XML file in flash, and Flash fills out text fields and check and or unchecks Checkboxes based on the XML data.CheckBoxes are mandatory.But I don't see how I'll be able to use them if i can't create and condition statements based on the loaded Data.
View 1 Replies
Mar 30, 2011
why this code won't work
[Code]...
I'm sure you can put if statements inside other if statements, seriously I can't figure it out
View 4 Replies
Sep 22, 2010
I need to write an if statement inside an if-else statement. But no matter how I write it it keeps giving me a syntax error.The syntax error is "1083: syntax error: else is unexpected".[code]No matter how or where I place the braces, it keeps giving me errors.
View 13 Replies
Jul 12, 2010
what I'm trying to do is create an else if argument for each object in an array based on a user set number
Code:
for(var i:int=0; i < numberOfElseIfs; i++){
GENERATE AS3 CODE
}
to which I want it to GENERATE THE FOLLOWING CODE:
Code:
}else if(baskets[i].used == false){
baskets[i].used = true;
drawButton(i);
}
the problem is obviously that the compiler reads this code rather than understanding I'm trying to regenerate the code within the for loop...does that make sense :S? So basically I need as3 to read the code between the for statement as if it is going to echo that out later. Is this even possible?
View 4 Replies
Oct 2, 2009
See [URL] Now there is a button called Answera, which when clicked should have a symbol (movie clip) called Check appear at the cordinated specified. Check exists in the libary (but does not have an instance name) and no where else on the stage. when I run this code I get: 1180: Call to a possibly undefined method Check. -> var rightCheck = new Check(); How is it undefinded if it exists in the libary?
View 7 Replies
Jan 27, 2011
The following is my codes. This is still work in progress; so, you will see some functions with empty contents. Plus, this is my first Flex application; please bear with me. This is a quiz application that gets the questions and answers to each questions from a ColdFusion web service. There are three types of questions, True or False, Multiple Choice with single selection, and Multiple Choice with multiple selections. So, based upon the question type, the application would dynamically generate the appropriate amount of radio buttons or check boxes for the users to select. I got these working. The problem that I am having is, I am not sure how to check what the users have actually selected. In some other forums and posts on other web site, it said that I can use event.currentTarget.selectedValue to get the user selection. But when I actually do it, I got a run-time error saying, "Property selectedValue not found on mx.controls.FormItem and there is no default value." My question is, what do I need to do to capture the user selections?
[Code]...
View 1 Replies
Sep 22, 2010
I have a script which is giving me a lot of trouble since I have no idea how to write another "if statement" inside another if-else statement. I keep getting errors, I guess I don't know where to put the braces exactly...
example:
if(bla == bla) {
<------------how would I write another if statement here?
}else if (bla == bla){
}
View 3 Replies
Dec 18, 2011
I have a movieclip on the screen called "mc_bg". Within this movieclip are 7 movieclips called "barrier1" through "barrier7".From main.as I want to be able to do this call:
for (var i: int = 1; i < 3; i++ ){
trace("got here")
trace(mc_bg["mc_barrier" + String(i)])
[code]....
View 1 Replies
Jun 11, 2009
Is it possible to use a if statement with a eventlistener in it?
eg
if(myBut_btn.addeventlistener(MouseEvent.CLICK)){
[code]....
View 2 Replies
Nov 9, 2010
So I've been reading a lot today about the with statement performance, readability and stuff like that but i'm still not sure whether i should or should not use the with statement in AS3.
Using the with statement seems the same as creating local var which would carry the reference.
View 4 Replies