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

454

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 17, 2021 Sep 17, 2021

Copy link to clipboard

Copied

xml is easier to parse.

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 17, 2021 Sep 17, 2021

Copy link to clipboard

Copied

Can you show me how to?

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 17, 2021 Sep 17, 2021

Copy link to clipboard

Copied

How can I parse the XML data in Animate CC?

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 17, 2021 Sep 17, 2021

Copy link to clipboard

Copied

var r = new XMLHttpRequest();
r.open("GET", "your xml file.xml", true);
r.addEventListener("load", rF);
r.send();

function rF(e) {
parser = new DOMParser();
var xml = parser.parseFromString(e.target.response, "text/xml");

// the exact parsing depends on the structure of the loaded xml file.
alert(xml.getElementsByTagName("a tag name")[0].childNodes[0].nodeValue);
}

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 17, 2021 Sep 17, 2021

Copy link to clipboard

Copied

Thanks. Will this work with the Jeopardy game also?

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 17, 2021 Sep 17, 2021

Copy link to clipboard

Copied

I got errors when I tried it. Can you possibly break it down for me?

This is the xml file I'm 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
Adobe Community Professional ,
Sep 18, 2021 Sep 18, 2021

Copy link to clipboard

Copied

what errors and 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 18, 2021 Sep 18, 2021

Copy link to clipboard

Copied

I used the code above. Next I tried to use the URLLoader code, but when I tried it, nothing showed up.

Am I doing something wrong?

This is the code I'm using now...

var myXML:XML = new XML();
var myXMLURL:URLRequest = new URLRequest("puzzle1.xml");
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);

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

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

var answers:XMLList = myXML.children();
var numAnswers:int = answers.length();
var i:int = 0;

for(i=0; i<numAnswers; i++){
var myAns:Answer = new Answer();
myAns.answer_txt = answers.attributes("name");
}
}

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 19, 2021 Sep 19, 2021

Copy link to clipboard

Copied

are you creating an as3 project or html5/canvas?

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 19, 2021 Sep 19, 2021

Copy link to clipboard

Copied

I am creating an as3 project

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 20, 2021 Sep 20, 2021

Copy link to clipboard

Copied

you probably want:

 

var myXML:XML = new XML();
var myXMLURL:URLRequest = new URLRequest("puzzle1.xml");
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);

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

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

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

for(i=0; i<numAnswers; i++){
var myAns:Answer = new Answer();
myAns.answer_txt = answers[i]);
}
}

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 20, 2021 Sep 20, 2021

Copy link to clipboard

Copied

Tried it, but it says "Type Coercion failed: cannot convert XML@40eafff23a1 to flash.text.TextField."

What should I do?

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 20, 2021 Sep 20, 2021

Copy link to clipboard

Copied

use:

 

for(i=0; i<numAnswers; i++){
var myAns:Answer = new Answer();
myAns.answer_txt.text += answers[i].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 21, 2021 Sep 21, 2021

Copy link to clipboard

Copied

Now it's saying "A term is undefined and has no properties."

I think it has something to do with the XML document. What should I do now?

 

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 numAnswers:int = letters.length();
var i:int = 0;

for(i=0; i<numAnswers; i++){
var myAns:Answer = new Answer();
myAns.answer_txt.text += letters[i].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 21, 2021 Sep 21, 2021

Copy link to clipboard

Copied

 

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 21, 2021 Sep 21, 2021

Copy link to clipboard

Copied

click file>publish settings>tick "enable debugging">retest.

 

the error message will reappear with the problematic line number.  if that doesn't make the solution obvious to you, indicate 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 ,
Sep 21, 2021 Sep 21, 2021

Copy link to clipboard

Copied

Well, I finally figured out a formula. How can I do the addChild effect?

 

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);
letter_txt.text = puzzle.item.answers.answer[0];
trace("Data loaded.");
}

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 22, 2021 Sep 22, 2021

Copy link to clipboard

Copied

 by the "addChild effect", do you mean you want to display all your answers in a separate textfield?:

 

 

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 22, 2021 Sep 22, 2021

Copy link to clipboard

Copied

Yes I do.

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 23, 2021 Sep 23, 2021

Copy link to clipboard

Copied

do you have those textfields on stage or are you going to create them dynamically (by having a textfield in a movieclip and that movieclip has a linkage id)?

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 23, 2021 Sep 23, 2021

Copy link to clipboard

Copied

create them dynamically

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 23, 2021 Sep 23, 2021

Copy link to clipboard

Copied

textfield in a movieclip and the movieclip has a linkage id

can you show me how to do textfields on stage as well?

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 23, 2021 Sep 23, 2021

Copy link to clipboard

Copied

create a new movieclip with a textfield tf.  assign class name TF_MC.

 

var myXML: XML = new XML();
var myXMLURL: URLRequest = new URLRequest("puzzle1.xml");
var myLoader: URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);

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

var answers: XMLList = myXML.children()[0].children();

var numAnswers: int = answers.length();
var i: int = 0;
var nextY = 0;

for(i = 0; i < numAnswers; i++) {
var tf_mc = new TF_MC();
addChild(tf_mc);
tf_mc.name = "tf_"+i;
tf_mc.tf.text = answers[i].toString();
tf_mc.x = 20
tf_mc.y = nextY;
nextY += tf_mc.height;
}
}

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 23, 2021 Sep 23, 2021

Copy link to clipboard

Copied

It worked! However, one only text box showed up.

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

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

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

var answers: XMLList = myXML.children();
var numAnswers: int = answers.length();
var i: int = 0;

for(i = 0; i < numAnswers; i++) {
var myAns:Answer = new Answer();
myAnswers.addChild(myAns);
myAns.x = 300;
myAns.y = 400;
}
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