PDA

View Full Version : need help....DOS simulator


The_Chemist
10-28-2005, 03:35 PM
I have problem on a project on how to make a basic simulation of DOS?
In a single dynamic text, how can I make a prompt, which will accepts command and behaves just like DOS?and If I press the enter key, and nothing is typed on the prompt then it will go to the next line and show the prompt in the next line: how can I do that?

C:\>
C:\>

and, if I typed a reserved word, then the system will not erase the previously typed words:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings>cd ..

C:\>?
'?' is not recognized as an internal or external command,
operable program or batch file.

C:\>

Is there a way to do that?
tnx...:)

Ruben
10-28-2005, 04:51 PM
Sure, you would have to create an array (http://www.actionscript.org/tutorials/intermediate/Arrays/index.shtml) with all the preserved words and things you want the dos-simulation to recognize, every time the enter-key (http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary393.html) is pressed loop (for..in (http://www.actionscript.org/tutorials/intermediate/loops/index.shtml)) through every value of that array, see if there is one of the array its values typed (indexOf (http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary692.html)), and display the corresponding message...

...and that's basically how you would go about doing what you want...

- Ruben