Skip navigation

Monthly Archives: April 2009

This time were going to make a simple inter-action of Flash MX and Visual Basic.
Yes, you read me right. We can send information from Flash to Visual Basic and vice-versa.

Now, lets start from designing our flash file (*.swf) to be include in our Visual Basic.

1. Create a new Flash document (*.fla)
2. Change the document size to 250px by 200p and the background to anything you want.


3. Click on the Rectangular Tool and draw the rectangle with 100×25 size on the stage.
4. Select the rectangle and change it symbol to Button, name it anything you want. Then click Ok.


5. Double-Click on the Symbol Button. And you will be warp to the Symbol Button Timeline.
In this case our symbol button is named Symbol 1.
Notice the Symbol 1 on the Timeline and Up, Over Down, & Hit on the Frames.

6. Insert a new Layer on the Timeline, make sure its above the first layer.
Then click the Text Tool on Toolbox and place it in the center of the button.
And set the text property to Static Text.

7. On the Timeline, Highlight the Up, Over,Down, Hit and convert the Over frame to a Keyframes for both layer.


8. Design the behavior of the button according to your taste.
9. Were done with the button. Go back to Scene 1.


10. Put a Text on the stage from the Toolbox and write “Message from Visual Basic”.
Then set its text property Dynamic Text.


And set its Instance Name to “txtvb” and its Variable Name to “msgvb”.

flash11 The instance name will be our reference for the text we create.
And the variable name will handle the value of the text.

11. In the Components Window, drag a TextInput on the stage.

flash12 And name its Instance to “txtmx”.


Its time to take action!
12. Select on the button and open the Actions Panel.
Your Current Selection on the Script Navigator should be the button.
Type the following code on Script Pane.

on (press) {
var msgmx = txtmx.text;

13. Save your work and publish.
To publish, navigate to the Main Menu > File > Publish. Or press <shift+F12>.