Copy link to clipboard
Copied
Hi there!
I am creating a Quiz where the user selects one of the two multiple choice options. If correct, the user is prompted to click on the star movieclip which depicts it moving
and being placed on the star templates at the bottom. After the scene has completed this tween, it automatically spawns in a star at those coordinates.
For some reason, the first star is staying throughout the whole process, however, the other stars if correct, are being removed from the stage once the next question has been answered as correct.
Scene where user must click on star to add it:
var starOneClaimed:Boolean = false;
stop();
star.addEventListener(MouseEvent.CLICK, claimStar);
Correct.play();
function claimStar(evt:MouseEvent):void
{
starOneClaimed = true;
Sparkle.play();
gotoAndPlay(52);
}
If the user gets the answer correct, (starOneClaimed) -> spawn one in at the exact coordinates of the template so that it stays there for the next 6 questions (7 total):
import flash.display.DisplayObject;
stop();
if(starOneClaimed)
{
var starOne:ClaimedStar = new ClaimedStar();
starOne.x = 200;
starOne.y = 357;
stage.addChild(starOne);
}
It is adding it to the stage, however, once the second star has been claimed (2nd question), and the 3rd question is asked, it removes the 2nd star from the stage. And this process repeats for each question asked, the star before is removed.
When this button is clicked to continue to the next question:
Notice there is a star in the top left, however the coordinates are the same except the x is altered a small part from the others. I dont understand. Help please?!
Copy link to clipboard
Copied
Ask in the correct forum, which presumably is the Flash Pro one.
Mylenium
Copy link to clipboard
Copied
I cant for some reason 😕 It doesnt let me choose it
Copy link to clipboard
Copied
I have notified someone who might be able to help that the Flash forums all appear to be disabled as far as adding new postings go, as well as not being able to move this one there. Hopefully they can resolve that as fast as they were able to mess it up. They have been shutting some of the less used ones down (most are these days) and likely got carried away clicking things.
Meanwhile, can you explain how you have this file arranged as far as the code goes? You mention "scene" and your code shows changing locations along the timeline, while your naming of variables appears to be related only to the first star (starOne) even though it is clear you create an instance of it at least once. How does the code for adding the other stars look?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now