Skip navigation


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.

flash01

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

flash03

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.
flash04

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.

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

flash05

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

flash08

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

flash10

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”.

flash13

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;
fscommand("setvalue",msgmx);
}

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: