Flashbot Tutorial Details

The Flashbot script has now been updated to Actionscript 3 (AS3). It is available here.

After setting up a bot with Pandorabots fantastic ALICE variant, I wanted more control over the appearance of the interface and thought that using Flash was a good way to go.
This is how I created a basic flash interface to be used with the Pandorabots engine. You may well want to add more functionality, sound, animation, but hopefully this will give you a step in the right direction. I’m not a very good flash programmer, so there could well be areas that could be improved, refined.
Source files flashbot.fla (64kb).
Open up flash and create a document to the size you require.

Step 1 : On Frame 1, place a textbox along the top length of your scene allowing for a button on the right hand side, set this as ‘Input text’ and give it the name ‘user’. Give this a line type of ‘Single Line’. Check the ‘Show border around text’ property. This is the area that the user will type in his/her questions.

Step 2 :Place a large textbox, filling up the remainder of the space. This should be set as ‘Dynamic Text’ and be called ‘reply’. Give this text area the line type of ‘Multiline’ and check the ‘Render as HTML’ and ‘Show border around text’. This is where the responses from Pandora will appear.

Step 3: Place another textbox at the bottom right of the stage. This should be set as ‘Dynamic Text’ and be called ‘custid’. Give this text area the line type of ‘Single Line’ and check the ‘Render as HTML’ and ‘Show border around text’. This is to show you the CUSTID. This can be on the stage, or hidden off the stage.

In the actions on this frame place:

Ok. You now need to create a Button on the stage. Quickest and simplest way for this is to create a small box with the drawing tools. Drag and select this box, right click and select ‘Convert to Symbol’. Select ‘Button’ and there you have it.
Drag it into place next to the input text box.
Make sure the button is selected and open up the actions.
Copy and paste this script into the actions of the button :

An explanation of this script
In order for you to contact pandorabots, you need to send the variables ‘input’, ‘botid’ & ‘custid’ (if the user has previously visited).
When you send variables to http://www.pandorabots.com/pandora/talk-xml, you receive back a reply formatted in XML.






Whilst the user is waiting for a reply from the pandora server (which is normally very quick), it is good to let the User know that what he has typed is being dealt with. We replace the main reply text with a message of our choosing ;

We also delete the user’s input text so that it is cleared for the user to start typing again ;

Once we know that the data has been received, we can parse the XML for the information we require.

Save, publish and hopefully you’ll have a nice new flash interface for your Pandorabot !
It should look something like this :

Comments on This Post
Rob

Awesome! I’ve been looking everywhere for someone to merge Flash and AIML-like technology…. you rock!

26th October 2006
Matthew Cavanagh

Hey there Jamie. My name is Matt, and I am having SO many problems integrating my GaitoBOT AIML applications with ANY web interfaces. Pandorabots.com doesn’t support the kind of AIML I am using. Any ideas?

26th October 2006
jamie

I’m afraid I don’t know then. This flashbot was specifically designed to work with the format of AIML exported from pandorabots. Sorry Matt !
jamie.

26th October 2006
alex

The link to the ‘basic’ tutorial is broken – do you still have it, and if so, can I see it? Thanks!

26th October 2006
jamie

Should be back again now, in it’s old format. It was accidentally deleted, oops !

26th October 2006
Yordan

Hello, Jamie Durrant
You say google but still except for the forums where Square Bear is registered there isn’t any help regarding pandorabots in flash. I kinda found solutions for most of the problems that occurred, but one of them remains. There must be some difference between ActionScript 1.0 and 2.0 and even if I copy/paste everything from your file the custid box still says “undefined” and that way my bot thinks everyone that talks to him as the same person (I’ve tested it). Do you work with newer versions of Flash? I can’t get help from anywhere else.
P.S. also sorry for spamming LEO with random letters, I forgot to change the botid when copied the code.

26th October 2006
FlashBot AS3 Update | Jamie Durrant

[…] Related posts:Flashbot Tutorial Details […]

26th October 2006
Let us know your thoughts about this topic