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 :

You must be logged in to post a comment.

Scroll To Top