A1VBCode Forums

flash & vb integration sample


http://www.a1vbcode.com/vbforums/Topic32032.aspx

By softprotect - 7/6/2013

this is a flash & vb integration sample

to teach you advanced manipulation between VB & Flash.

if you anderstand this project you will able to create a real flash desktop application and flash game with joystick support.



FlashVars.zip



FlashVars:

will teach you (calFunction) vb & flash manipulation



download [url=http://www.a1vbcode.com/app-5663.asp[/url]
By softprotect - 7/7/2013

thank u for replay

how do i can reupload the zip file, or edit ?



>> You haven't even put the Flash Player on the Form. In readme first.txt you say before run the project add flash object to the form.



when u add latest version of flash player and save the project u will get an error.

but if u created EXE file there is no problem with flash object.



but when delete the flash object and save the project there is no problems.



>> You haven't used Option Explicit in the JoyControl.frm there are errors.



fix the form name bug by rename it to (player)



delete the joycontrol form and replace it with this code:



Option Explicit

Private myJoy As JOYINFOEX

Dim r&



Private Sub Form_Load()



Static TheX As Long

Static TheY As Long



' Hide the mouse cursor.

'ShowCursor (False)

' Tell form to receive joystick functions.

r& = joySetCapture(hWnd, JOYSTICKID1, 1, 0)

r& = joyReleaseCapture(JOYSTICKID1)

' Get joystick position coordinates and fill in the TheX and TheY

' variables.

r& = joyGetPosEx(JOYSTICKID1, myJoy)

TheX = myJoy.dwXpos

TheY = myJoy.dwYpos





End Sub



Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)



' Show the mouse cursor.

'ShowCursor (True)





End Sub



Private Sub Form_Resize()



' Disable the timer.

'If Form1.WindowState = 0 Then Timer1.Enabled = False





End Sub



Private Sub Form_Terminate()



' Show the mouse cursor.



ShowCursor (True)



End Sub



Private Sub Form_Unload(Cancel As Integer)



' Show the mouse cursor.



ShowCursor (True)



End Sub



Private Sub Timer1_Timer()



myJoy.dwSize = 64

myJoy.dwFlags = JOY_RETURNALL

' Get the joystick coordinates.

r& = joyGetPosEx(JOYSTICKID1, myJoy)

' If a joystick's button is pressed, put the number of the button in

' label4.

If myJoy.dwButtons > 0 Then

' Label4.Caption = myJoy.dwButtons

'JOY_Buttons

player.ShockwaveFlash1.SetVariable "JOY_Buttons", myJoy.dwButtons

Else 'NOT MYJOY.DWBUTTONS...

player.ShockwaveFlash1.SetVariable "JOY_Buttons", vbNullString

End If

' Fill the textboxes with the joystick coordinates.



Text1.Text = myJoy.dwXpos / 1000

Text2.Text = myJoy.dwYpos / 1000

Select Case Mid$(Text1, 1, 2)

Case "32"

'_level0.__joyRL



player.ShockwaveFlash1.SetVariable "_level0.__joyRL", vbNullString

Case "65"

player.ShockwaveFlash1.SetVariable "_level0.__joyRL", "65"

Case "0"

player.ShockwaveFlash1.SetVariable "_level0.__joyRL", "0"

End Select

Select Case Mid$(Text2, 1, 2)

Case "32"

'_level0.__joyUD

player.ShockwaveFlash1.SetVariable "_level0.__joyUD", vbNullString

Case "65"

player.ShockwaveFlash1.SetVariable "_level0.__joyUD", "65"

Case "0"

player.ShockwaveFlash1.SetVariable "_level0.__joyUD", "0"

End Select



End Sub