<< Chapter < Page Chapter >> Page >
Listing

Source code for quiza.as.

package CustomClasses{ import flash.events.*;import mx.containers.VBox; import mx.controls.Button;import mx.controls.RadioButton; import mx.controls.TextArea;import mx.events.FlexEvent;public class QuizA extends VBox{ private var theQuestion:TextArea;private var choice00:RadioButton; private var choice01:RadioButton;private var choice02:RadioButton; private var checkButton:Button;private var result:TextArea;private var theAnswer:String;//numeric string private var correctAnswer:String;//actual stringprivate var vboxWidth:int = 375; //==================================================//public function set question(textIn:String):void{theQuestion.text = textIn; }//end implicit setterpublic function set answer(answerIn:String):void{theAnswer = answerIn; }//end implicit setterpublic function set choice0(choice:String):void{choice00.label=choice; }//end implicit setterpublic function set choice1(choice:String):void{choice01.label=choice; }//end implicit setterpublic function set choice2(choice:String):void{choice02.label=choice; }//end implicit setter//==================================================//public function QuizA(){//constructor width=vboxWidth;setStyle("borderStyle","solid"); setStyle("backgroundColor",0xffff00);theQuestion = new TextArea();theQuestion.editable = false; theQuestion.width=vboxWidth - 2;addChild(theQuestion); choice00 = new RadioButton();choice00.groupName="radioButtonGroup"; addChild(choice00);choice01 = new RadioButton();choice01.groupName="radioButtonGroup"; addChild(choice01);choice02 = new RadioButton();choice02.groupName="radioButtonGroup"; addChild(choice02);checkButton = new Button();checkButton.label = "Click to Check Answer"; checkButton.addEventListener(MouseEvent.CLICK,checkButtonHandler); addChild(checkButton);result = new TextArea();result.editable = false; result.width=vboxWidth - 2;result.visible=false;addChild(result);//Register an event listener that will be // executed when this object has been fully// constructed. It will set the height of // the VBox based on the sum of the heights// of the components. this.addEventListener(mx.events.FlexEvent.CREATION_COMPLETE, vboxCompleteHandler);}//end constructor //==================================================//private function checkButtonHandler(event:MouseEvent):void{ result.visible=true;if(theAnswer == "0"){correctAnswer = choice00.label; }else if(theAnswer == "1"){correctAnswer = choice01.label; }else{correctAnswer = choice02.label; }//end elseif((theAnswer=="0"&&choice00.selected) || (theAnswer=="1"&&choice01.selected) || (theAnswer=="2"&&choice02.selected)){result.setStyle("color",0x00ff00); result.text = "Correct\nCorrect Answer is: "+ correctAnswer; }else{result.setStyle("color",0xff0000); result.text = "Wrong\nCorrect Answer is: "+ correctAnswer; }//end else}//end checkButtonHandler //==================================================//private function vboxCompleteHandler(event:mx.events.FlexEvent):void{ //Set the height equal to the sum of the// heights of the components plus six // pixels per component to account for the// space between components. this.height =theQuestion.height + choice00.height+ choice01.height + choice02.height+ checkButton.height + result.height+ 36;//six spaces per compnent }//end vboxCompleteHandler//==================================================// }//end class}//end package

Questions & Answers

Ayele, K., 2003. Introductory Economics, 3rd ed., Addis Ababa.
Widad Reply
can you send the book attached ?
Ariel
?
Ariel
What is economics
Widad Reply
the study of how humans make choices under conditions of scarcity
AI-Robot
U(x,y) = (x×y)1/2 find mu of x for y
Desalegn Reply
U(x,y) = (x×y)1/2 find mu of x for y
Desalegn
what is ecnomics
Jan Reply
this is the study of how the society manages it's scarce resources
Belonwu
what is macroeconomic
John Reply
macroeconomic is the branch of economics which studies actions, scale, activities and behaviour of the aggregate economy as a whole.
husaini
etc
husaini
difference between firm and industry
husaini Reply
what's the difference between a firm and an industry
Abdul
firm is the unit which transform inputs to output where as industry contain combination of firms with similar production 😅😅
Abdulraufu
Suppose the demand function that a firm faces shifted from Qd  120 3P to Qd  90  3P and the supply function has shifted from QS  20  2P to QS 10  2P . a) Find the effect of this change on price and quantity. b) Which of the changes in demand and supply is higher?
Toofiq Reply
explain standard reason why economic is a science
innocent Reply
factors influencing supply
Petrus Reply
what is economic.
Milan Reply
scares means__________________ends resources. unlimited
Jan
economics is a science that studies human behaviour as a relationship b/w ends and scares means which have alternative uses
Jan
calculate the profit maximizing for demand and supply
Zarshad Reply
Why qualify 28 supplies
Milan
what are explicit costs
Nomsa Reply
out-of-pocket costs for a firm, for example, payments for wages and salaries, rent, or materials
AI-Robot
concepts of supply in microeconomics
David Reply
economic overview notes
Amahle Reply
identify a demand and a supply curve
Salome Reply
i don't know
Parul
there's a difference
Aryan
Demand curve shows that how supply and others conditions affect on demand of a particular thing and what percent demand increase whith increase of supply of goods
Israr
Hi Sir please how do u calculate Cross elastic demand and income elastic demand?
Abari
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Object-oriented programming (oop) with actionscript. OpenStax CNX. Jun 04, 2010 Download for free at http://cnx.org/content/col11202/1.19
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with actionscript' conversation and receive update notifications?

Ask