Wheel of Fortune

New Here ,
Sep 16, 2021 Sep 16, 2021

Copy link to clipboard

Copied

I would love to make a wheel of fortune puzzleboard.

How can I make one? Should I use a text file or XML?

Views

446

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 25, 2021 Sep 25, 2021

Copy link to clipboard

Copied

all your textfields are on-top of each other.  check my code

 

tf_mc.x = 20
tf_mc.y = nextY;
nextY += tf_mc.height;

 

 

and fix yours

 

myAns.x = 300;
myAns.y = 400;

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 27, 2021 Sep 27, 2021

Copy link to clipboard

Copied

Text won't display and every textbox is stacked

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 27, 2021 Sep 27, 2021

Copy link to clipboard

Copied

what code are you using?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 27, 2021 Sep 27, 2021

Copy link to clipboard

Copied

var xmlRequest:URLRequest = new URLRequest("puzzle.xml");
var myLoader:URLLoader = new URLLoader(xmlRequest);
var puzzle:XML;
myLoader.addEventListener("complete", xmlLoaded);

function xmlLoaded(e: Event): void {
puzzle = XML(e.target.data);

var myAnswers:Sprite = new Sprite();
myAnswers.name = "answers";
answers_mc.addChild(myAnswers);

var answers: XMLList = puzzle.children()[0].children();
var numAnswers: int = answers.length();
var i: int = 0;
var nextY = 0;

for(i = 0; i < numAnswers; i++) {
var myAns:Answer = new Answer();

myAns.letter_txt.text = answers.attribute("text");

if(numAnswers>5){
myAns.x = 50;
myAns.y = nextY;
nextY += myAns.height;
}

myAnswers.addChild(myAns);
}
myAns.name = "text" + (i+1).toString();

}

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 28, 2021 Sep 28, 2021

Copy link to clipboard

Copied

what's the trace show:

 

var xmlRequest:URLRequest = new URLRequest("puzzle.xml");
var myLoader:URLLoader = new URLLoader(xmlRequest);
var puzzle:XML;
myLoader.addEventListener("complete", xmlLoaded);

function xmlLoaded(e: Event): void {
puzzle = XML(e.target.data);

var myAnswers:Sprite = new Sprite();
myAnswers.name = "answers";
answers_mc.addChild(myAnswers);

var answers: XMLList = puzzle.children()[0].children();
var numAnswers: int = answers.length();
var i: int = 0;
var nextY = 0;

for(i = 0; i < numAnswers; i++) {
var myAns:Answer = new Answer();

myAns.letter_txt.text = answers.attribute("text");

if(numAnswers>5){
myAns.x = 50;
myAns.y = nextY;
nextY += myAns.height;

trace(i,myAns.letter_txt.text);
}

myAnswers.addChild(myAns);
}
myAns.name = "text" + (i+1).toString();

}

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 28, 2021 Sep 28, 2021

Copy link to clipboard

Copied

It works. I meant i wanted the textboxes shown horizontally.

Sorry about the confusion. The text works, though.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 28, 2021 Sep 28, 2021

Copy link to clipboard

Copied

use:

 

var xmlRequest:URLRequest = new URLRequest("puzzle.xml");
var myLoader:URLLoader = new URLLoader(xmlRequest);
var puzzle:XML;
myLoader.addEventListener("complete", xmlLoaded);

function xmlLoaded(e: Event): void {
puzzle = XML(e.target.data);

var myAnswers:Sprite = new Sprite();
myAnswers.name = "answers";
answers_mc.addChild(myAnswers);

var answers: XMLList = puzzle.children()[0].children();
var numAnswers: int = answers.length();
var i: int = 0;
var:int nextX = 0; // or wherever

var:int nextY = 0; // or wherever

var:int letter_spacing = 5; // or whatever

var:int leading = 30; // or whatever

for(i = 0; i < numAnswers; i++) {
var myAns:Answer = new Answer();

myAns.name = "text" + (i+1).toString();

myAnswers.addChild(myAns);

myAns.letter_txt.text = answers.attribute("text");

myAns.letter_txt.autoSize = "left";

myAns.x = nextX;

if(myAns.x+myAns.width>Stage.stageWidth){

nextY+=leading;

nextX = 0; // or whatever

}
myAns.y = nextY;
nextX += myAns.width+letter_spacing;

}

}

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 28, 2021 Sep 28, 2021

Copy link to clipboard

Copied

I keep getting this....

"Cannot access a property or method of a null object reference."

But, what part is null?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 28, 2021 Sep 28, 2021

Copy link to clipboard

Copied

what's the code on the line triggering the error.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 28, 2021 Sep 28, 2021

Copy link to clipboard

Copied

Same code above

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 28, 2021 Sep 28, 2021

Copy link to clipboard

Copied

Specifically this one,

"myAns.letter_txt.text = answers.attribute("text");"

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 29, 2021 Sep 29, 2021

Copy link to clipboard

Copied

either myAns.letter_txt or answers don't exist.

 

to find which use:

 

trace(myAns.letter_txt.);

trace(answers)

 

above the problematic line of code.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 01, 2021 Oct 01, 2021

Copy link to clipboard

Copied

Fixed the text problem. But, it's still showing only one text.

 

var xmlRequest:URLRequest = new URLRequest("puzzle.xml");
var myLoader:URLLoader = new URLLoader(xmlRequest);
var puzzle:XML;
myLoader.addEventListener("complete", xmlLoaded);

function xmlLoaded(e: Event): void {
puzzle = XML(myLoader.data);

var myAnswers:Sprite = new Sprite();
myAnswers.name = "letters";
answers_mc.addChild(myAnswers);

var letters: XMLList = puzzle.children();
var numLetters: int = letters.length();
var i: int = 0;

for(i = 0; i < numLetters; i++) {
var myAns:Answer = new Answer;
myAns.letter_txt.text = puzzle[i].item.letter.@text;
myAns.letter_txt.autoSize = "left";
myAns.x = 200;
myAns.y = 300;
myAns.name = "letter" + (i+1).toString();
myAnswers.addChild(myAns);
}
}

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 03, 2021 Oct 03, 2021

Copy link to clipboard

Copied

this is, at least, the third time you've made the same error.  your textfields are all overlapping.  ie, fix:

 

myAns.x = 200;
myAns.y = 300;

 

i think i've shown you how to do that by arranging them vertically and by arranging them horizontally.  what is it that you don't understand about how to assign x and y properties to arrange objects on stage?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 03, 2021 Oct 03, 2021

Copy link to clipboard

Copied

I think I know what happened. I just traced it and all the letters are together to form the word.

I need them separate. That's why I was seeing one box. Other than that, I understand the x and y.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 03, 2021 Oct 03, 2021

Copy link to clipboard

Copied

 It worked! I finally got it!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 03, 2021 Oct 03, 2021

Copy link to clipboard

Copied

LATEST

One more thing, can you make columns? If so, how?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines