Topic: Flash MX scenario (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=11443" title="Pages that link to Topic: Flash MX scenario (Page 1 of 1)" rel="nofollow" >Topic: Flash MX scenario <span class="small">(Page 1 of 1)</span>\

 
BigAl
Obsessive-Compulsive (I) Inmate

From: NZ
Insane since: Jun 2003

posted posted 09-01-2003 07:43

Hi fellow inmates,
I'm a would-be action-scripter working on a scenario which loads words from a sentence into text boxes.
You can see it here: http://www21.brinkster.com/vectoralpha/jon/sentence/scenario_004.fla (I hope)

I'm having some trouble and wonder whether anyone could give me a wee nudge in the right direction.

As you will see I have found a way to load random sentences from a set of, at this stage, 5.
However there's a bit of a problem as a new sentence doesn't always load. (I presume that is because one of the random posibilities is that the same sentence will load?) I tried to fix this by the "if current sentence==random sentence" bit.
What I would like to be able to do now is load the words from one sentence randomly into the boxes, for the user to be able to organise them for themselves.

What do you think?
Cheers - BigAl

BigAl
Obsessive-Compulsive (I) Inmate

From: NZ
Insane since: Jun 2003

posted posted 09-01-2003 12:29

Rats...How about this? http://www15.brinkster.com/harrysite/sentence/scenario_004.fla




Steve
Maniac (V) Inmate

From: Boston, MA, USA
Insane since: Apr 2000

posted posted 09-01-2003 15:30

Possible reason: Your button's code says:

code:
if (randomPhrase==currentPhrase){
randomPhrase=randomPhrase+1;
}


You have 5 phrases, and ask it to pick randomly from among them. If you display the fifth phrase and ask it to display phrase [5+1] - well, there's a problem, because you don't have 6 phrases, do you? You need a mechanism to increment the phrase # unless it's #5, in which case you decrement it, or something.

I'm a bit perplexed by this movie. Are you intending at some point to randomly swap words as well as phrases? If not, why do you break it up into boxes for individual words instead of just longer boxes for entire phrases?

Anyway - it's a cool beginning!

BigAl
Obsessive-Compulsive (I) Inmate

From: NZ
Insane since: Jun 2003

posted posted 09-05-2003 00:43

Hi, Steve
Thanks for your thoughts and words of encouragement.
Not having any previous programming experience I get lost in the complexities of the code.
As you correctly surmise, the aim is to have the single words load into random boxes.
Then the user will be able to drag and drop the words into empty boxes to assemble a sentence.
For an example, (albeit employing a Java applet), see: http://www.manythings.org/sw/gasoline.html

I see that the "random()" function I have been trying to use is deprecated...
Anyway, that's a little more explanation. Now back to the drawing board.

BigAl

Steve
Maniac (V) Inmate

From: Boston, MA, USA
Insane since: Apr 2000

posted posted 09-05-2003 01:12

Ah - That's cool.

And also pretty complex to program.

You can get a random sentence without too much problem from an array of sentences. You're nearly there now. You can split each sentence into individual words using string.split() with the space character as the delimiter. You can count how many words there are in the array with array.length, and then attach as many boxes with dynamic text fields as there are words in the array, filling those boxes with the words chosen randomly. You can make each of those boxes draggable. I believe there's even a way to get the individual boxes to have adjustable widths based on the word length. That's all (relatively) easy. (I say that, because even I could figure this much out - probably.)

BUT - getting the boxes to "snap' next to each other in the "tray", and most of all writing the logic to recognize the correct order of words will most certainly not be easy. (I say that because I don't have a clue how to begin this!)

But it WILL be fun! Good luck. Ask when you get stuck and we'll make a stab at helping.



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu