Copy link to clipboard
Copied
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 ![]()
1 Correct answer
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
Copy link to clipboard
Copied
you're not embedding your font.
and the code in message 52 removes everything that's on stage.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
So how i can remove just letter?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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;
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
What a hell??? When I restarted *.fla everyting is working fine. THIS IS INTRESTING...
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
(p.s when using the adobe forums, please mark helpful/correct responses, if there are any.)
Copy link to clipboard
Copied
Where is no simple way to split the answer from question after the "/"? And use one txt file?
Copy link to clipboard
Copied
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.