• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Wheel of Fortune

Community Beginner ,
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

8.3K

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

Copy link to clipboard

Copied

xml is easier to parse.

Votes

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

Copy link to clipboard

Copied

Can you show me how to?

Votes

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

Copy link to clipboard

Copied

How can I parse the XML data in Animate CC?

Votes

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
Community Expert ,
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);
}

Votes

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

Copy link to clipboard

Copied

Thanks. Will this work with the Jeopardy game also?

Votes

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
Community Beginner ,
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.

Votes

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
Community Expert ,
Sep 18, 2021 Sep 18, 2021

Copy link to clipboard

Copied

what errors and what code are you using?

Votes

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
Community Beginner ,
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");
}
}

Votes

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

Copy link to clipboard

Copied

are you creating an as3 project or html5/canvas?

Votes

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

Copy link to clipboard

Copied

I am creating an as3 project

Votes

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
Community Expert ,
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]);
}
}

Votes

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
Community Beginner ,
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?

Votes

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
Community Expert ,
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();
}
}

Votes

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
Community Beginner ,
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();
}
}

Votes

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

Copy link to clipboard

Copied

 

Votes

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
Community Expert ,
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.

Votes

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
Community Beginner ,
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.");
}

Votes

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
Community Expert ,
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?:

 

 

Votes

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

Copy link to clipboard

Copied

Yes I do.

Votes

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
Community Expert ,
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)?

Votes

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

Copy link to clipboard

Copied

create them dynamically

Votes

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
Community Beginner ,
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?

Votes

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
Community Expert ,
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;
}
}

Votes

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
Community Beginner ,
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();
}

Votes

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