Tuesday, 11 May 2010

Displaying the sticker book when a question is answered correctly

Next thing I did was make it so the sticker book automatically appeared on the stage when the user had answered a question correctly.

This actionscript is telling the movieclip to bring the question buttons back onto the stage and also if the answer the user chose is correct then open the sticker book. Then it tells the movie clip to remove the current movieclip which is the question.

Once the user has clicked ok then sticker page is displayed but the next bit of code is needed to make it appear and it is played within the actionscript layer on the main timeline:
stop();

import mx.transitions.Tween;
import mx.transitions.easing.*;

_root.openStickerBook = function() {
var yStickerTween:Tween = new Tween(_root.stickerBook, "_y", Regular.easeOut, -330, -72, 1, true);

};

For each question that is answered correctly a different sticker is unlocked. The question movie clip will need to know which frame to go to in the stickerbook movieclip so I put the following actionscript on frame one within the question movieclip:


The actionscript above shows that if the user answer answers the question correctly, will will go to frame to within the stickerbook movie clip which will then display the unlocked sticker which is the starfish.

No comments:

Post a Comment

Followers