Question

I've been trying to find a source code or tutorial or anything that I can work with, but so far I haven't had any luck. The closest I've come was using haXic, but without a way to change how the input box looks (I was able to fix this in the open source files, but without being able to change the compiler, the fix won't stick in the resulting .swf), I can't achieve the desired font and color.

So I'm turning to Actionscript 3 / Flash, as I have some knowledge of it, although mostly used for constructing websites. The goal is to create a very, very, very simple game based on traditional text adventure structure. When I say simple, I mean really simple. I don't need maps, I don't need NPCs, I don't need items, I don't even need to have a list of commands that can be accessed at any time. All I need is to display some text, accept a specific input, and then display some more text based on what that input is.

Here's an example of what I'm trying to achieve: The .swf loads up, the user sees some text imitating a POST. This isn't an actual preloader, just some fancy "everything is starting up" text. At the end of the animation, the user is instructed to press any key to continue, and doing so removes the existing text and loads in the next set. From there I'd like to have various steps requiring certain input (i.e. asking users for a username, requiring the input of username: , but this doesn't actually have to store the username, just have the valid format of username: name detected before continuing to the next step) and either outputting additional text or wiping the existing text and simulating the start of a new program.

I'm guessing that this mostly involves calling various functions based on input, and then changing what the expected inputs are within those functions, but I really don't have any idea where to get started. I've also noticed in what few examples I've seen, that input text is submitted through the use of a button. Is there any way to get this to work with just the enter key, to simulate a command console?

I'm certainly not expecting a complete source code, just a few pointers. Any help is appreciated, thanks! I'm also open to suggestions other than Actionscript, however the resulting game needs to be able to run in a web browser, and some form of animation for the text is preferred.

Was it helpful?

Solution

While this is definitely possible to do in Flash, I would highly recommend using plain HTML5/Javascript for this task. This way you're almost guaranteed to have the widest platform adoption (XBOX browser, iOS safari). Javascript can be just as effective here for animations.

For using Flash, I would start with the TextField class for the input and TextArea component for output.

For HTML, it's as simple as a form input field and using javascript to update a div area for the output.

Good luck on your project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top