One of the things that Flash is good for is
making great user interfaces, which is a feature most other
programming languages lack. I’ve discovered a way to make a
user-friendly interface in Flash, and then use that
interface inside a Visual Basic Application.
For an example of
what you will be creating, download the following
file, unzip it, and run the vbSample.exe program:
[
extract and open the file vbFlash.exe ]
Steps to Create
Program
The following steps will guide you in creating the
files you opened above:
-
Start Flash MX, and make a new
movie with any dimensions you would like. I used
the dimensions 200px by 150px.
-
Next, make a new Button Symbol,
and name it anything you want:
[
create a new button symbol ]
-
Make a rectangle in the first
frame of the button, about 10 X 50 pixels, any
color other than your background color. Align it
to the center of the scene.
-
Make a Key Frame in the next 2
frames of the button, and change the colors of the
button for each frame:
[
modify the button for the up, over, and down
states]
-
Make a new layer, and put the word
“Click” in that layer.
-
Now, go back to the Scene 1, and
drag an instance of the Button onto the scene.
-
Drag a Text Field from the toolbox
onto the scene, and give it the Dynamic Text
property:
[
the text field and button ]
-
Set the Instance Name to:
“testField” and the var to: “testVar”.
[
the properties text field ]
-
Click on the Button on the Scene,
and open the “Actions” box.
-
Type:
[
copy and paste the above code ]
-
Publish the movie as a SWF File,
save, and exit Flash MX.
Visual Basic
Instructions
Now, you will get to use the above animation in
Visual Basic:
-
Run Visual Basic, and start a new
Standard EXE project.
-
Go to “Project | Components”, then
look for the component called: “Shockwave Flash”
this comes with every Flash Movie Player install,
so if you can view Flash movies, you should be
fine:
[
the shockwave flash component ]
-
Drag an instance of the Shockwave
Flash component into your main form. Add a Text
Box, and a button.
-
Go to the Code Editor, and enter
the following code:
[
copy and paste the above code ]
-
That’s it! Make the EXE file, and
save it in the same folder as the flash movie,
then run the exe!
If you have any questions, please do not
hesitate to post on the forums at:
kirupaForum.
Seifer Tim