Professional :: If Else Conditional Statements For Dynamic TextFields

Nov 29, 2010

This is about a self assessment quiz.There will be four options and each one has a scale from1-5 i.e., "option a" has 1mark, "option b" has 2marks,"option c" has 3 marks, "option d" has 4marks and "option e" has 5 marks and we count the answered and we display the score for example if there are 20 question in it if they answered "option e" 5 times the score will be 25 and option d 5 times the score will be 20, and if "option c" for 5 times the score will be 15,and "option b" for 3 times the score will be 6 and "option a" two times the score will be 2, and we add up all the score and display in a dynamic text field called "score" and the total score is 68.

And I have another dynamic text field called "tsc" where I have to display the tags like excellent , good, better ......etc. Till now every thing is fine but I am unable to compare them it is displaying excellent even if i get 10 marks. If the score is greater than 55 "tsc" should display Excellent, if the score is greater than 41 or less than 55 "tsc" should display Best, if the score is greater than 26 or less than 40 "tsc" should display Better,if the score is none of the above "tsc" should display Poor.

This is my code on the submit button:
on (release) {
gotoAndStop("sQ");
if (scor>=55) {
tsc = "Excellent";
} else if (scor == 41 && scor<=55) {
[Code] .....
Where:"sQ" is the frame name where i am displaying the score details"scor" is the var name for the dynamic text field for displaying total score"tsc" is the var name for the dynamic text field for displaying the tags llike good, Excellent, better, poor.....etc.

View 4 Replies


Similar Posts:


ActionScript 2.0 :: Flash 8 - Using This With Conditional Statements

Sep 28, 2010

When use the full path name and the identifier of a movie clip, my conditional statement works fine. However, when I swap the identifier out with "this", it no longer works. This script is contained within the movie clip I am trying to reference. I have found that, "this" works fine by itself on the timeline. It just stops working when I place it within a conditional statement.

Here is my script:
function functionOne() {
randomX = 550*Math.random();
randomY = 400*Math.random();
} functionOneInterval = setInterval(functionOne, 1000);
function functionTwo() {
[Code] .....

The reason I am trying to use "this" instead of the identifier name is because the movie clip it is referencing will be duplicated. This script here generates a random destination point for an enemy spaceship and tells it to constantly move to the changing points. This script is contained within the enemy spaceship movieclip, and I am planning on duplicating several of them at once.

View 1 Replies

ActionScript 3.0 :: Conditional Statements With Numbers?

Jan 25, 2010

I want to write AS3 code that has 2 variables;  one that acts on odd numbers and the other that acts on even numbers entered into a text field ?(sorry I'm not making much sense here! Will explain the context further)I'd like to use an XML calendar in my Flash project that shows the odd or even dates in the calendar depending on what number you enter in a field being either an odd or even number. (This is based on ACT Water Restrictions odd and even watering restrictions)It means that if your street number is an odd number you can use water as per restrictions when the date also is an odd number. Similarly, if your street number is an even number you can water as per restrictions when the date also is an even number. You're probably familiar with this system.
  
The context is for my Adult Migrant students to understand the concept of our water restrictions here which is governed by this odd and even system.So what I'm doing to do next is buy a cheap XML calendar online which I can adapt for my project but I'm not sure whether I should be approching this code problem with an  if/else statement to get the results or something else?how to write the code!!
 
if my number I enter is an even number then display (in an XML calendar) even days
else
if my number I enter is odd then display (tin an XML calendar) odd days

View 5 Replies

Flex 3 - Conditional Statements For A Repeater

Jul 12, 2011

I have an xml file that has a start date and length of a project... I use a repeater to load each project. The users' screen only shows 2 weeks at a time. I would like to make it so that if a project doesn't fall within the two weeks on screen, that the project isn't loaded. I could do this by sorting through the XML and finding the correct projects to load, and putting them into an array collection, but there's a "move date" button which allows the user to change the two weeks that are showed. Once the two weeks are changed, I would need the projects that fit into that new 2 week window to show.

[Code]...

View 1 Replies

Actionscript 3.0 :: Color Conditional Statements?

Aug 8, 2010

I'm having difficulty getting a conditional statements to recognize a statements equality even if the condition exists

Even if movieClip_mc is 0xA6A6A6 then the function will not execute:
Code: Select allvar myColorTransform = new ColorTransform();
myColorTransform.color = 0xFF0000;

[code].....

View 2 Replies

ActionScript 2.0 :: Conditional Statements For Arrays?

May 22, 2007

I'm trying to call movieclips depending on the data in the array, but I can't seem to get the conditional statements right, so that it works

var outfitArray:Array = new Array;
//Set function parameters
function createArray():Void {

[code]......

View 1 Replies

ActionScript 3.0 :: Using One Series Of Conditional Statements For Several Different Objects?

Mar 13, 2012

-Let's say you have several doors on stage for a game.
 
-Each door has the ability to change color.
 
-When any two doors are the same color, a player can move between those two doors.
 
To do this, I use code similar to the following:
   
doorThree.addEventListener(MouseEvent.CLICK,dooraction);
function dooraction(event:MouseEvent){
if ("Blue") {

[Code]....
 
Is there a way to use this one series of If statements for all doors, or must I copy and paste the same instructions for each door instance? In the game I'm planning, each door actually has more than two dozen states, so if I can use just one series of if statements, I'd like to do that.

View 3 Replies

ActionScript 3.0 :: Use Input Text With Conditional Statements?

Jul 9, 2009

I'm extremely new to AS3, and programming in general, and so hopefully this will be a simple problem someone can help me solve. I'm trying to have a user input a number in a text box, and then depending on what they input, take them to a different frame. (it's a math quiz, and the users are answering an addition problem). I think I need to define the variable type of the text box somehow before the code will work, but I'm not exactly sure what to do or how to do it.[code]...

View 3 Replies

ActionScript 2.0 :: Conditional Statements With Keyboard Events?

Jul 14, 2009

I'm trying to load and unload UI Component based on the using pressing UP. When they press the UP key i want the UI component to load a specific image. When they press it again I want the image to be unloaded. And if they press it again I want it to be loaded again, etc...Currently when I press the UP key it loads the image but it never unloads.Here's my current code:

Code:
var count:Number = 4;
var evenOrOdd:String;

[code]....

View 2 Replies

ActionScript 3.0 :: Conditional Statements For Click Referring To Loaded Swf

Jun 10, 2009

The last big hurdle I have, is the following, and I hope someone can just throw me a bit of guidance on this.I am looking for a way to write a function, that on click of my "next" button in the main timeline, will refer to my loaded swf MovieClip(imageLoader.content) telling it to go to the next frame label, so really a compound if/then situation - just referring to the loaded file throws me.So, my next button is "pNext," and what I am looking for is something along the lines of:[code]

-if (loaded movie) is on frames 12-144, then go here (on click),

-if (loaded movie) is on frames 144-155, then go here (on click)

View 8 Replies

ActionScript 3.0 :: Forcing Code Execution Order In Conditional Statements?

Feb 17, 2010

I have created an image gallery where each "slide" is an image loaded by one UILoader component. Everything works, except I noticed that as a user it is annoying to wait for each new slide to load.So, even with my limited knowledge of AS3, I decided to figure out a way to load the next upcoming image before the user requests itone for odd numbered slides, one for even numbered slides. That way, when the user is viewing a slide with an odd number in the first loader, the next image can be loaded into the second (currently invisible) loader and ready to go when requested button would simply toggle the visibility of these two loaders.

function nextButton(event:MouseEvent):void
{
imageNumber++;

[code].....

View 11 Replies

Professional :: Visibility, Order And Position Of Dynamic Textfields Inside Movieclip?

Dec 16, 2010

this concerns flash cs5 and the timeline.Everybody knows the effect you get when you use appendText() to add text to a multiline dynamic textfield, right ? Well, I have a movieClip as a container, and I would like dynamic textfields to populate this movieclip in the same manner as textStrings would populate the dynamic Textfield. 
 
How would this work?I have buttons that trigger addChild() function so as to populate the movieclip with textfields, but how do I make sure that the textfields make up an arbitrary list as a menu user chooses which buttons to click?
Let's say this is the visible text when the swf runs.(I cut away some of the code to make this more to the point):
 
var buttonTrace:TextField=new TextField;
addChild(TextClip.buttonTrace); buttonTrace.x=0;
buttonTrace.y=0;
buttonTrace.text="Breadcrumbs";
 
Now for each time I click a button in the menu I've made, a new textfield appears with the name of the button. This is how I want it. BUT......... How do I control the display properties and positioning of dynamic textfields within a movieclip ? How do I control persistent visibility, and how do I make these textfields appear one after the other in the order they were clicked.

View 7 Replies

Professional :: Dynamic Classic TextFields - Text Fields Display Errors

Jun 16, 2011

I'm trying to implement some dynamic classic TextFields, but I am seeing errors when the text tries to render. What I am doing is trying to implement a system that shows tolkens and a cash eguivent, I'm using the code

[Code]....

I'm thinking there is something in the TextField that is not set correctly, I tryed to set the autoSize to CENTER but that didn't fix much...

View 7 Replies

ActionScript 3.0 :: Using Mouse Events (mouse Leave) For Conditional Statements?

Dec 14, 2010

I have a menu drawer at the edge of the screen that shows when the user rolls the mouse over it, but if the user overshoots it an moves the cursor slightly outside the browser window this is unfortunenatly registered as a mouse out.

I want to stop this by using event.MOUSE_LEAVE, but i need to use it as a condition not to triger a "leaveHandler".

View 3 Replies

ActionScript 3.0 :: Conditional Display In Dynamic TextBox

Sep 15, 2009

I have a dynamic text box which gets populated depending on the value of a variable. However I am getting errors with my code. Here is my code.

Code:
story_txt.text=
if(percent<51) {
"Below 50";
} else if(percent>50) {
"Above 50";
};

The errors get are:
1084: Syntax error: expecting identifier before if.
1084: Syntax error: expecting rightbrace before leftbrace.

View 1 Replies

ActionScript 3.0 :: Conditional Scrollbars For Dynamic TextBox?

Mar 25, 2009

I have a dynamic text box. It has x, y width, and height all set. I have scrollbars built for it. They work great. Now, I just need those scrollbars to be conditional. And it's not so obvious to me how to do that. If I have a fixed height already set, I can't just say if the height is greater than this. If I set the autoSize then it goes with the autosize regardless of what I do.

View 1 Replies

ActionScript 2.0 :: Displaying Dynamic Text - Conditional If Statement?

Feb 9, 2010

I have a dynamic text box (called navgxchangeBox below) that is being fed by an xml file.Depending on the output (weather positive or negetive) I'd like the text to display green (for pos) or red (for neg). I know I need to write a if conditional statement but not sure if it is correct. The text is displaying in color, but I don't think the condition loop is executing. Can anyone look at my code below and tell me what I am doing wrong?

ActionScript Code:
//
var myXML = new XML();

[code].....

View 3 Replies

Professional :: Multiple Statements One Drop Box?

Apr 9, 2010

So I am creating a drag and drop game but the thing is that there is not one question for each statement. Is it possible to have say... 10 statments on the right and one "box" on the left where the statements can be dragged to, if its correct it stays there, if its incorrect it goes back to its original position.

View 12 Replies

ActionScript 3.0 :: Using FONTS For Dynamic Textfields?

Sep 12, 2011

What is difference between Using Device Fonts and Using Embedded Fonts for dynamic textfields?

View 3 Replies

ActionScript 2.0 :: Why Are The Dynamic Textfields Selectable

Feb 16, 2007

why are the dynamic textfields selectable? The textfield is inside a movieclip. Once the clips are attached, why can they not act like buttons?

ActionScript Code:
xmlData = new XML();
xmlData.ignoreWhite = true;

[Code].....

View 5 Replies

ActionScript 2.0 :: My Dynamic Textfields Won't Delete

Dec 11, 2007

2 of my external swf's use dynamic text fields, they call into my index fine but when the code says delete that movie all but the dynamic text fields are deleted. The links that have these text fields are the Cart and Contact Us. [url]...

View 3 Replies

ActionScript 3.0 :: Dynamic Textfields And Listing Them

Mar 13, 2010

so i want to have my dynamic text listed with a consistent space between each textfield. However, the textfields can have varying amounts of text, so just doing txt.y = t*40 would not cut it. I've tried getting txt.length to calculate how many lines it would be, but if i change the font size it changes everything.

View 2 Replies

ActionScript 3.0 :: Using Multiple If Else Statements & Manual Dynamic Xml Data Input To Trigger A Goto And Play

Dec 19, 2011

Below is code that has a timer countdown that reads off of the computer. Below in bold is code to read "if it reaches the date, go to and play frame (2).

[Code]...

Below is code that is manual input - I had set up a dynamic txt field in flash named it : raffle_tix_remain When loaded on to the host I can manulally update the xml code and the change will take effect. raffle_tix_remain.text = root.loaderInfo.parameters.raffle_tix_remain;

My question: Since the raffle_tix_remain is a manual input from a user to xml Is there a way to tell flash once it refreshes and "raffle_ tix_ remain" goes to (0)zero gotoAndPlay(2); and let it play like a "sold out" sign i guess that would be a if else statement.

[Code]...

View 1 Replies

ActionScript 2.0 :: Adding Up Numbers In Dynamic Textfields?

Nov 9, 2010

let's say you had a dynamic text field with a number (for example '30'). Everytime you click on a certain button / movie clip, that triggers an animation (so far no problem) AND adds '20' to the number in that textfield.

==> first click, the number displays 50 (30+20), second click 70 (50+20) ...

When you enter a certain keyframe and that number is higher than let's say 290, the movie jumps to frame x. If that number equals 290 or is lower than 290, the movie jumps to frame y.

View 4 Replies

ActionScript 3.0 :: Setting Dynamic Widths For Textfields?

May 28, 2009

I have 3 textfields. they're in a sprite container. 1. date 2. pipe_mc movieclip 3. title field. I need to set it so that the textfield/mc/textfield;s x property changes dynamically when a shorter or longer date gets added into the field, via XML.

[Code]....

View 6 Replies

Actionscript 2 :: Create Dynamic Textfields In A Loop?

Aug 12, 2010

I want to populate the stage with a list of dynamic text fields with individual names, something like pg4_txt1, pg4_txt2, pg4_txt3. I'm a novice at flash, I tried creating variables with a while loop, but I just haven't got the grasp of it.

Here's some kind of weird pseudo code to explain what I want to do:

var leading:Number = 15;
var i:Number = 0;
while (i<14) {

[Code].....

View 1 Replies

ActionScript 3.0 :: Evenly Spaced Dynamic TextFields?

Feb 5, 2009

I have a few textField objects that are created dynamically with XML. I want to space them evenly horizontally, how would I do that? So far this is all I have, but it does not account for different character lengths per textField.

Code:
for (var i:int = 0; i < xmlList.length(); i++) {
var tf:TextField = new TextField();

[code]........

View 5 Replies

ActionScript 2.0 :: How To Format Dynamic TextFields Globally

Sep 13, 2009

In my project, several textField mclips are created dynamically. These mclips pull their content from an XML from.

The text is formatting partially using TextFormat, but I have been unsuccessful setting the font family.

I think this is because the content is dynamic and called from the XML.

In any case, I then tried to set the font family using mx.styles, but also with no luck:

import mx.styles.CSSStyleDeclaration;
var text_style:Object = new CSSStyleDeclaration();
_global.styles.myStyle = text_style;

[Code].....

View 3 Replies

ActionScript 2.0 :: Dynamic TextFields Does Not Display All Specified Word

Aug 19, 2010

I make a dynamic textfield, specify it's instance, then assign it a string or variable with AC, but often the dynamic text will not display all the text or variables. For example, I say
warning.text = "Please do not enter more info than necessary.";
Yet what appears onscreen, is:
"lease do not enter more ino tan neesary."
This happens no matter how big I make the text area, or how small I make the text, so I don't get why it's not all viewed. (Btw When I copy from the textfield I do get all the text)

View 5 Replies

ActionScript 2.0 :: Dynamic Textfields - Embed Fonts?

Jun 29, 2004

how to embed fonts as for some reason i can get the font im using to show up Here is the script i used to create the textfields:

[Code]...

as you can see from the 2 images i have put up with the fonts active on my system e.g font_on the text is ok but with the fonts turned of e.g fonts_off i get a different text even thou the fonts are done addressed in my script.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved