0 Replies - 988 Views - Last Post: 08 January 2009 - 04:47 PM

#1 cciissssii   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 08-January 09

Need help with buttons when making a true and false quiz

Post icon  Posted 08 January 2009 - 04:47 PM

I need some help with two buttons. I've followed a tutorial showing how to make a quiz with an input-field and one submit-button. But I need to make it two true- and falsebuttons instead and I'm not sure how to do this. I'm all new with flash and actionscript so I would appreciate if you didn't go in too deep ;)

I'm not working with keyframes. I have four layers and one stage, the layers are background, actions and a layer for each button. Each button has it's own instance name. I have an object called mc.question1 in the library on witch I put the linkage to "Export to actionscript".

This is my code:

var q1: String = "Andreas kleerup är född den 2 maj 1979";
var q2: String = "Amanda Jenssen blev känd genom tv-programmet “Talang 2007”";
var q3: String = "Amandas Jenssens första singel hette ”Do you love me?” ";
var q4: String = "Backyard babies har gett ut en självbiografisk bok som heter ”Blod, svett och tårar”";
var q5: String = "Andreas kleerup har fått diagnosen ADHD";
var q6: String = "Backyard Babies har haft samma uppsättning bandmedlemmar sedan 1995";
var q7: String = "Amanda Jenssen var tidigare medlem i bandet ”Oh Hollie Neverdays”";
var q8: String = "Andreas kleerups låt ”With every heartbeat” släpptes år 2007 ";
var q9: String = "Marit Bergman och Roger Pontare har varit med och skrivit låtarna på Amanda Jenssens debutskiva";
var q10: String = "Backyard Babies har tidigare haft namnen ”Tyrant” och ”Dead Silence”";
var q11: String = "Backyard Babies medlemmar är Andreas Tyrone Svensson , Johan Blomquist, Peder Carlsson och Nicke Borg";
var q12: String = "Amanda Jenssens låt ”Do You Love Me” har använts i några scener i ett avsnitt av den amerikanska dramaserien ”The Wire” ";
var q13: String = "Andreas kleerup har varit musikalisk ledare för programmet ”Bingo Royale”";
var q14: String = "Tillsammans med Robyn har Andreas Kleerup haft stora framgångar med låten ”Lay me down” ";
var q15: String = "Backyard Babies senaste album, ”Backyard babies”, producerades av Jakob Hellner";

var a1: String = "falskt";
var a2: String = "falskt";
var a3: String = "sant";
var a4: String = "falskt";
var a5: String = "sant";
var a6: String = "falskt";
var a7: String = "sant";
var a8: String = "sant";
var a9: String = "falskt";
var a10: String = "sant";
var a11: String = "sant";
var a12: String = "falskt";
var a13: String = "sant";
var a14: String = "falskt";
var a15: String = "sant";

var noOfQuestions = 15;
var correct:Number = 0; 
var whichQuestion:Number = 1;

_root.attachMovie("mc.question1", "question_mc", _root.getNextHighestDepth(), {_y:Stage.height/2, _x:Stage.width/2});

question_mc._alpha = 0; 
loadClipOpacity(question_mc, q1);

[b]submit_btn.onRelease = function()
	if(whichQuestion < noOfQuestions)
		unloadClipOpacity(question_mc, _root["q"+whichQuestion]);
		var endText:String = "You had "+correct+" correct answers.";
		unloadClipOpacity(question_mc, endText);

function whatQ(theQ:Number)
	if(_root["a" + theQ] == input_txt.text)
		return true;
			return false;

function unloadClipOpacity(mc:MovieClip, theText:String)
	var i:Number = 100;
	mc.onEnterFrame = function()
		this._alpha = i;
		i -= 10;
		if(i < 1)
			delete this.onEnterFrame;
			loadClipOpacity(mc, theText);

function loadClipOpacity(mc:MovieClip, theText:String)
	mc.fraga1_txt.text = theText;
	mc._alpha = 0;
	var i:Number = 0;
	mc.onEnterFrame = function()
		this._alpha = i;
		i += 10;
		if(i >= 100)
			delete this.onEnterFrame;

I know that I have to do something about the bold part, cause that's for the other type of quiz..but what? How do I make the buttons the two answering alternitives? And how do I tell the program which is the right answer?

The questions are in the top, below are the answers (in swedish). Sant=True and Falskt=False.

Can someone please help? :)

Is This A Good Question/Topic? 0
  • +

Page 1 of 1