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

question and word game random upload from txt file.

Explorer ,
Dec 31, 2015 Dec 31, 2015

Hello. I have simple txt file:

Where is Eiffel tower?;paris

King of music instruments?;organs

What is my name?;harry potter

I want that flash random select the question and upload to question dynamic text field "question"

But for answer I have biggest task.

In library I have movie clips with names a; b;c;d;e;f;g;....

After question i want that flash uploads the movie clip in line:

For example question Where is Eiffel tower?

Answer PARIS

Flash in one line uploads movie with name "p" "a" "r" "i" "s"

Maby someone have some ideas? How script have to look? Sorry I new in AS3 but i think i will learn. i study every script i got to know how it works;) thanks for your help

TOPICS
ActionScript
2.5K
Translate
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

correct answers 1 Correct answer

Community Expert , Jan 03, 2016 Jan 03, 2016

the last error (about line 4, answer) is not in my code.

for the rest, that should be:

kglad wrote:

i assumed you were going to use a separate answers.txt with the nth line being the answer to question n.  if that's the case your code is setup to handle that:

//////////////////////////////// being frame 1 code  /////////////////////

var myLoader:URLLoader = new URLLoader();

myLoader.load(new  URLRequest("questions.txt"));

myLoader.addEventListener(Event.COMPLETE,  questionsLoaded);

var quest

...
Translate
Community Expert ,
Jan 06, 2016 Jan 06, 2016

you're not embedding your font.

and the code in message 52 removes everything that's on stage.

Translate
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
Explorer ,
Jan 06, 2016 Jan 06, 2016

Then I dont understand how to do it.... On font is a button EMBED. Then I checked Character Ranges to ALL and finished. I have font in my library.

Translate
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
Explorer ,
Jan 06, 2016 Jan 06, 2016

So how i can remove just letter?

Translate
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 ,
Jan 06, 2016 Jan 06, 2016

assign it a name and use getChildByName to remove it.

or add all the letters to a common parent and remove all children from that parent.

or add the letters to an array and loop through the array to remove the letters.

Translate
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
Explorer ,
Jan 07, 2016 Jan 07, 2016

Ok I will try to do something with removechildren. Still is not working but I will try to find solution for that

Now i want to do that all line of letters childrens will be in center of the stage. I write some thing but my IF is not working. I dont understand why? I think I always get false... Never mind odd or even every time I get false.

var raides:int = answerS.length;

var word:int

if (raides % 2 == 0){

    word = (((raides * 150) + ((raides - 1) * space))/2 - 150);

} else {

    word = ((((raides -1) * 150) + ((raides - 1) * space))/2)-75;  

}

var nextX:int = x - word;

Then i try this, but its not working too

var raides:int = answerS.length;

var word:int;

function centravimas(word:int){

if (raides % 2 == 0){

    word = (((raides * 150) + ((raides - 1) * space))/2 - 150);

} else {

    word = ((((raides -1) * 150) + ((raides - 1) * space))/2)-75;  

}

)

var nextX:int = x - centravimas;

Translate
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
Explorer ,
Jan 07, 2016 Jan 07, 2016

I tried everything with odd and even numbers but i have diferent result.

Sometimes 7 is odd sometimes is even.

Number 2 sometimes is even sometimes is odd. All numbers can be even and odd.

Translate
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
Explorer ,
Jan 07, 2016 Jan 07, 2016

What a hell??? When I restarted *.fla everyting is working fine. THIS IS  INTRESTING...

Translate
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
Explorer ,
Jan 07, 2016 Jan 07, 2016

IM GOING CRAZY...

How I said before I want to do then I press A key play movie with instance name A.

stage.addEventListener(KeyboardEvent.KEY_DOWN, AKeyDown);

function AKeyDown(event:KeyboardEvent):void{

if (event.keyCode == Keyboard.A){

A.play();

}

}

BUT I have error.  1061: Call to a possibly undefined method play through a reference with static type Class.

I think this is because what i havent object in flash with A instance name. Me need to use class name like instance name...


But how can I do that?

Translate
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
Explorer ,
Jan 07, 2016 Jan 07, 2016
LATEST

I added script exactly on object:

stage.addEventListener(KeyboardEvent.KEY_DOWN, AKeyDown);

function AKeyDown(event:KeyboardEvent):void{

if (event.keyCode == Keyboard.A){

play();

}

NOW IM STILL TRYING TO REMOVE CHILDRENS, BUT Im full of errors...

Translate
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 ,
Jan 03, 2016 Jan 03, 2016

(p.s when using the adobe forums, please mark helpful/correct responses, if there are any.)

Translate
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
Explorer ,
Jan 03, 2016 Jan 03, 2016

Where is no simple way to split the answer from question after the "/"? And use one txt file?

Translate
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
Explorer ,
Jan 03, 2016 Jan 03, 2016

Last code with answers.txt have some eroors and I not understant what he wants from me...

Scene 1, Layer 'Layer 4', Frame 1, Line 29    1120: Access of undefined property questionLoaded.

Scene 1, Layer 'Layer 4', Frame 1, Line 31    1120: Access of undefined property answerLoaded.

Scene 1, Layer 'Layer 4', Frame 1, Line 39    1120: Access of undefined property aArray.

Scene 1, Layer 'Layer 4', Frame 1, Line 9    1120: Access of undefined property questionLoaded.

Scene 1, Layer 'Layer 4', Frame 2, Line 4    1120: Access of undefined property answer.

Translate
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