hi all I have alot of array which i want to Shuffle and diplay on a text i tried a Shuffler a took form this forum but no did not work
Printable View
hi all I have alot of array which i want to Shuffle and diplay on a text i tried a Shuffler a took form this forum but no did not work
howdy alhurayas,
not completely sure what you are having trouble with...the sort fxn appears to work;
if the problem is that you want to display the entire list of terms (the whole array), then where you have this in the AS of the btns:
try this:Code://_root.framtext.dynamicTxt = (myLetters25[i]);
and
_root.framtext.dynamicTxt = (myLetters24[i]);
Maybe you could describe what you want to happen at each btn click...Code:_root.framtext.dynamicTxt = (myLetters25);
and
_root.framtext.dynamicTxt = (myLetters24);
Also, do you intend to have blank spaces after the array elements 'yes' and 'zero'?
the idea is read game for kids where in text display a word ( arrayA words starting with the letter a ......arrayz words starting with the letter z)
then the array have been all words call ( read ) i wnat the button to be disable preventing the same words to start again
when i used your code all the words of the array displayed on the text i juist want word by word until the end of the array .
ps there another problem which i will tell you about but for now letts solve this one thankkkkkss for your replay
Okay, now i understand. Here are some things to consider:
First: You have used a single variable (i) as a counter for both buttons. If you click nutton2 twice and then click nutton1, you will get the third element of the Z array - even though you have only clicked nutton1 once. Rather, you want to have each button increment its own variable. You could use "i" with the particular letter (such as ia, ib, ic,... iz). It is best to declare such variables on the main timeline (in the actions layer, frame 1) so they are accessible by all scripts throughout the movie. Then you will just need refer to each variable using the pathSecond: There is another way to 'pull' the words from the array that might work better for you: You can use the Array.shift method to remove the first element of an array. (Look at this page for more about Array.shift) In this way, you would not need to track 26 variables. You could just check the array after each shift, and disable the button if the array is emptyCode:_root.myLetters25[i]
Third: Will you eventually have 26 buttons? Consider using a loop to create/name/place each of the 26 buttons. That is how the buttons are created for this demo
Also: Where you have _root.nutton2.enabled = false; you can just use this.enabled = false;
thank you alot i tried it this was but did not wordcode:
on (press) {
//checks to see if i isn't higher than the length of the array
if (ia<myLetters25.length) {
_root.framtext.dynamicTxt = (myLetters25[ia]);
trace(myLetters25[ia]);
//increments i
ia++;
//else, if i is the same as the length of the array, perform an action:
} else {
_root.nutton2.enabled = false;
_root.nutton2._alpha = 20;
trace("end 2");
}
}
but did not work another thing is the use of this.enabled = false; did not work now iam using flash mx2004
it worked in mx
thank again you are a great help
i also used what you Recommended the shift did not use
code:
on (press) {
shifted = myPets.shift();
if (myPets.length<0) {
trace(myPets);
} else {
/// this.enabled = false;
_root.nutton2.enabled = false;
_root.nutton2._alpha = 20;
}
}
on a frame
myPets = ["cat", "dog", "bird", "fish"];
but also did not work thanks for any help
i also noticed that it will always take out one which will make one word undiplayed unread
hello fellas,
i was going to sit back and let azwaldo do all the dirty work on this one, but was too intrigued by the concept to let it go.
also it seems we are all in significantly different time zones so i thought i could help speed things up.
alhurayas, i like your game concept and commend you on your flash and english skills. keep at it.
it seems the biggest problem with your original file was that (as azwaldo noted) you were using the same counter variable "i" for determining the position in multiple arrays.
the first thing i did was initiate counter variables for each myLetters array:
code:
// c is for counter, the number is for which myLetters array it is for.
c23 = 0;
c24 = 0;
c25 = 0;
once i added this, both buttons went through the arrays as planned and disabled the buttons if their were no items left in the array.
Next, I figured that since you are going to have 26 buttons, it would be a real shame if you wanted to change your on(press) behavior and have to edit all 26 buttons.
being that each array has a number in its name and that same number is now being used as a counter variable for that array, i figured each button could have a number (counter) that tells a function which array to access and which array counter variable to update.
code:
//this function is on the main timeline
//each button has its own counter# that it sends to this function on(press)
button_press = function (counter) {
//set a variable that holds the name of the array to be referenced
arrayname = "myLetters"+counter;
//set a variable that holds the name of the counting variable we will increment
countervar = "c"+counter;
trace(newline+"***")
trace("arrayname= "+arrayname+newline+"countervar= "+countervar+newline+countervar+"= "+_root[countervar]);
//if our countervar is less than the arrays length than do things
if (_root[countervar]<_root[arrayname].length) {
_root.framtext.dynamicTxt = _root[arrayname][_root[countervar]];
trace(_root[arrayname][_root[countervar]]);
_root[countervar]++;
} else {
//i also gave your buttons appropriate names like button23, button24, button25
_root["button"+counter].enabled = false;
_root["button"+counter]._alpha = 20;
trace("end 2");
}
};
//each button now has a script like this:
on (press) {
button_press(24);
}
give it a look here:
http://www.doyouhaveapen.com/posting...ding_game.html
also as azwaldo noted, you could use a loop to place all the buttons on the stage, at the same time you could initiate your counter variables and button actions. if you need help let us know.
mx2004 attached if you need mx, let me know (i found that saving as mx puts my super long functions on one line which is annoying).
also I put in a few traces that will better illustrate what is going on.
oops attachment here
are ready to roll alhurayas?
this is an interesting project. many techniques that have not been mentioned yet can be used - several concepts that will probably be new to you, but stay with it and you will probably learn a lot. and, now that meglomor has joined the thread this is really a graduate-level flash lesson...
like to thank azwaldo for the help ( you too meglomor)
it is what i want exactly
if i will try to complete me game now thanks again
glad to hear it, alhurayas. FK rocks!
...and please post it here when you have a working version...
nice work men.
azwaldo here you are but there is a bug in it plays the last element of an array twice why
how to play
all of the player in the game use the keyboard while the teacher have control over the game using the mouse
play1 use the letter a ( it first )
play2 use the letter 5
play3 use the letter h
play4 use the letter n
thank you simple ha
azwaldo here you are but there is a bug in it plays the last element of an array twice why
how to play
all of the player in the game use the keyboard while the teacher have control over the game using the mouse
play1 use the letter a ( it first )
play2 use the letter 5
play3 use the letter h
play4 use the letter n
thank you simple ha
tried to attach it but too large 328k
there is the swf
Wow! Nice job in the design, al. And the interaction is very clean, too. I am impressed.
The bug might be in how you are looping or handling the counter variable... for example, there is a difference between using this:
counter++;
...and using this:
++counter;
Check this page for more about it.
Since the file is large, can you just post the ActionScript for the buttons and the fxns? Also, I did not understand what you are saying with this:Quote:
play1 use the letter a ( it first )
play2 use the letter 5
play3 use the letter h
play4 use the letter n
thank for all your help i willtry to fix it , about
play1 use the letter a ( it first )
play2 use the letter 5
play3 use the letter h
play4 use the letter n
spelling hit first 4 players who it the keyboard first get the chance to answer ( read) the letter are a for player1, n for player2 5 for player3 and h for player4
thankssssssss
Still not understanding this completely - the "spelling hit" (this is done by different players? do four people sit at the monitor with a finger on a different key?)Quote:
"...spelling hit first 4 players who it the keyboard first..."
if you get stuck with the counter/frameNumber bit, maybe you can just post the code for the fxn you are working on (if the file is too big to attach)
same mistake
i made the same mistake again (it for hit)
try to play it choose a letter the word will be display try to player 4 players useing the keyboard
( hit first ,his letter first)
play1 use the letter a
play2 use the letter 5
play3 use the letter h
play4 use the letter n hope i made myself clear
back to the code i tried
_root[countervar]++;
it this way
_root[++countervar]; one word each time
and i tried it this way
_root++[countervar];
err
there is the complete code thank you
_root[countervar]++; should work, if not, the problem may be elsewhere in your code...do you use the trace command to check (debug) your scripts? you can check out this tute for more on errors and debugging
have opened the text file you attached, but it is difficult to study AS code in that format* - but, i may have found one problem: you have used the same word ("counter") for a function name that you use elsewhere for a variable...try renaming the fxn
it is also helpful to use descriptive verbs for function names,
like function countClicks()
*I am also wondering why the file is so large at this point: are you using a lot of images? large sound files? maybe you could create a dummy copy of the fla ("Save as" with different name) and remove large sound files and images, then you could attach the fla here
thank you will i try again and agian to fix it
but still i think i need you help
this game is main your work and other flash pro ( from actionscrpit.org ) who helped me with button listern code
give me a day ... for trying .
thaaaaaaaaanks
:) :) :)
help azwaldo could not get it to work coorctly
p.s if you like the game i can send the fla by mail
:) :)
would you attach here a current copy of the .fla?
i'll have a look.
and - i apologize, but - i am still not sure how the game is supposed to work: please take a few minutes to describe, step by step, what you want the users to experience in the game
something like this:
1) five people sit at the computer
2) one person controls the mouse
3) the other four people ... ...
4) ...
5) the game starts as the mouse is ... ...
(until the game is over)
sorry if i am not clear , first of all it kids game
let's start playing kids which letter would like us to begin
teacher teacher a noo b no no z ok ok i will choose a letter how about s now ready yes teacher
the moves the mouse and click the letter s a word is displayed "snake" john it is letter on the keybaod which is for example n the move clip red bulb with soud appear indicating the a in first ( the other are disabled beacuse he he first )
....
good john answer it is snake
teacher : you are correct one point for you john now pick a letter john f teacher
the teacher moves the mouse and hit the letter f a word appear foot
one of the other student hit first his letter on the keybaord is(h)
teacher yes max ... good max one point and so on
hope a was clear this time forgive m e if i am not
trying to attach the fla but need to take something to make smaller (sound and some graphics)
thank you all thank you azwaldo
That description helped a lot, but I am still a little bit fuzzy...
Is the game supposed to teach students to recognize letters? Because they will see which letter the teacher is pressing, and then they also see the first letter of the word when it comes up on the screen.
If I am a player, when am I supposed to press my key?
After the teacher presses "s", for example, what keeps me from pressing my key as soon as the "s" word pops up?
Is it the teacher's speaking that signals when students should press a key?
I have edited what you posted, at least this is the best I can make of it:
_____Kids (Reading) Game_____
teacher: "let's start playing kids, which letter would like us to begin with?"
teacher: a?
students: no
teacher: b?
students: no
teacher: z?
students: no
teacher: ok i will choose a letter...how about s? ready?
students: yes
teacher moves the mouse and clicks the letter s
a word is displayed: "snake"
(you lose me with this next line)
john it is letter on the keyboard which is for example n
Here is the Main Question: What is it that john recognizes (or sees) that makes him want to press his key???
next line describes a movie clip to declare the winner... ...
the movie clip shows a red bulb with sound appear
indicating the a in first ( the other are disabled beacuse he he first )
How is john correct if he pressed the "n" key when the word was "snake" ???
... ...(continuing)...
teacher: good, john answer it is snake, you are correct one point for you,
here is the Main Question: How is john correct if he pressed the "n" key when the word was "snake" ???
... ...(continuing)...
(now john pick a letter)
john: f
teacher moves the mouse and hit the letter f
a word appears
foot
one of the other student hit first his letter on the keyboard (h)
[COLOR=darkred]Why does max press, and not john ...what did max see???
... ...(continuing)...
teacher: yes max ... good max one point and so on
This is now the longest thread which I have been a part of...hoorah! I, like meglomor, also admire you - learning english so you can learn Flash. Do you know of an online translator? did you once mention that you speak spanish? if so, you could maybe use a translator like the one at this site
these kids just started learling the alphabet they need to start reading word not so this game have words that the kids can read and if one of the children read correctly he gets a point and retsart the game by choosing another letter which the teacher press ( the chlidren now are waiting everyone want to read the next word to get the point) the game end when all of the words(arrays) have be called
it is a presentation kind of game
it is better it you have the fla of th game which i am trying to make smaller in size
thankkkkkkkkkkkk and so sorry
Please just answer two questions ...
1) So, in the green line above, do you mean that the student is reading the word out loud?Quote:
"...these kids just started learling the alphabet
they need to start reading word not(?)
so this game have words that the kids can read and
if one of the children read correctly
he gets a point and
retsart the game by choosing another letter
which the teacher press ( the chlidren now are waiting everyone want to read the next word to get the point) the game end when all of the words(arrays) have be called
it is a presentation kind of game..."
2) What is it that a student recognizes (or sees) that makes him decide to press his key? (Because it looks like a student could press his key even if he does not recognize the word - that would not work as a game)
We are so close that I feel like I am in a room with four other people, and they are little people (cause one of them needs to go to the bathroom).
alhurayas,
due to azwaldos patience and great translation
i think i am starting to understand a little better. maybe the following questions will help more:
so the kids are only supposed to press the button(key) if they know how to read the word?
if they press the key first and don't know the word they will still get point?
if the answer to the second question is yes, i would suggest you allow the teacher to click something that awards the point to who ever answers correctly. maybe it is in there already.
yes get a point if he read correctly
if did not read the word correctly a point is taken out from him
( with the help of the black board in the school the names and the point are writern trying to include in the game later )
if you have any question glade to answer
thank for your patience
okay, i think i understand (now i see why the random shuffling of words is important, otherwise a student might memorize the order of the words)
just to make sure, is the following correct? the teacher will actually be running the game - listening to the students as they read each word, and then assigning scores to a student if they said the word correctly?
as an interactive Flash "game", you'll want this to be fun for the kids - but you also want it to be an effective learning tool; so, i am going to think about this for a bit (am interested to see what meglomor thinks, too)
... and i think we will all see what can be done very very soon...
thanks for your help
i am glade that i have been understood thank you all
just to make sure, please tell me if the following is correct:
the teacher will actually be running the game - listening to the students as they read each word, and then assigning scores to a student if they say the word correctly?
Howdy alhurayas,
Here is a demo, you can see the effect at this page. The fla is attached below: "readinggamemx.fla"
Now you can have a scoring feature for your game. Just download the fla, open it up in Flash and use Test-movie (ctrl-enter) to see the effect.
Students can enter their name(s) into the boxes at the bottom. Clicking on the button above their name adds to their score. The reset button returns the scores to zero.
You can add these elements to your own movie. Just open this fla and your fla, copy/paste the code in the main timeline, and do the same with the buttons and text fields (make sure the button clips have instance names (1,2,3,and 4))
One more suggestion: I would change the "word image" display in your movie, change the colors or transparency, it is hard to read.
nice work azwaldo,
the only problem is that once i scored over 9,999,999,990 points the score did not display properly:)
very awesome contribution.
i think it makes for a much better user experience.
hey alhurayas,
i hope you do not mind my asking this, but...
How old are you?
haaaa
i am bout 30 years thank you
azwaldo you are the great
finally what you all have been waiting for the fla with out the sound
thanks
It looks like you are really learning a lot on this project. I am searching the forums at actionscript.org for your thread(s)...
What is your username at actionscript.org? (mine is azwaldo there,too)
i am still a beginer at actionscrpiting hot like pro
it is the same alhurayas
need your help on the _root[countervar]++;
action
almost done but not complete
i hope you do not mind my asking this, but
why did you ask about my age
thanks
:) :)
where are you guys help please
hello alhurayas, we are still here. To me it is unclear what the next step is to be solved. I think we got sidetracked into figuring out the general game rules that whatever problem remains got lost.
please post your latest file and describe what you need help with.
hope you are doing well.