Results 1 to 17 of 17

Thread: Calling flash in VB 6.0 [Resolved]

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    60

    Resolved Calling flash in VB 6.0 [Resolved]

    Hi, I have a application done using VB6.0. I want to ask 1 things. When I double click to open the application, can it first open a Flash (.swf) file b4 opening the application. Does the codings need to be done in the application itself or externally?
    Last edited by iori85z; Sep 28th, 2004 at 01:04 AM.

  2. #2
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424
    vb comes with flash ocx. why don't u that to play .swf files.

    what u r trying to do ? i mean, r u trying to show splash screens ? or want to play .swf files externally.

    If u want to play .swf files externally then it requires compatible flash player installed (you can download its new version from macromedia).
    Last edited by Deepak Sakpal; Sep 24th, 2004 at 04:40 AM.

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    60
    What I have now is that I already use macromedia flash to create a flash file (start.swf). What I wan to do now is that when I double-click to start my application, the flash screen will run finish and close b4 the application (GUI)really starts. This is something like a flash introduction screen, which many other ppl are doing. Its like when u first insert the macromedia studio mx cd to install, it will first start a flash screen b4 showing u the options to install.

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    you can do this pretty easily.

    First off Deepak, I am sure you probably said this in error, but the flash shockwave ocx comes with the flash player, not with VB itself.

    iori85z, if you go to the components list in VB6 look under Shockwave and you should find the control there. Just stick one on a form and you can have the flash play there as your "splash screen" before the application loads. It is a simple control to use and you dont need to specify many details for it to work other than the location of the swf file and for it to play or loop, etc... very simple

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    60
    Oh ok, I will go try it out. I update u guys again if it works or if there is any other problems, thanks alot.

  6. #6
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424
    sure . I am here.

  7. #7

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    60
    I managed to find the Shockwave Flash component under the components tab. I have put it on a form. But I don't know how to code it(call it) , can anyone please help? The directory which my flash is stored in is C:\Flash.


    Private Sub ShockwaveFlash1_OnReadyStateChange(newState As Long)

    End Sub

  8. #8
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424
    Just drop a flash control on form, don't change any property.
    VB Code:
    1. Private Sub Form_Load()
    2.     ShockwaveFlash1.ScaleMode = 3 'play movie in actual size
    3.     ShockwaveFlash1.Movie = "C:\Flash\YourFileName.swf"
    4. End Sub
    movie will be played automatically.

  9. #9

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    60
    OK, I managed to get it to run, however, after finish playing, the flash did not close automatically, how should i code it to make it close automatically? And 1 more thing is that when the flash loads, the main page which is suppose to load onli after the flash finish playing and exits loads up at the same time as the flash, why is that so? I've already put it to hide but it still show.

  10. #10
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424
    can u post ur project here.

  11. #11

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    60
    Code For The OK button, after the username and ID has been confirm, it will start the splash screen.

    Public Sub cmdOK_Click()

    strName = txtUsername.Text
    strPass = txtPassword.Text

    dbIP.Open "dsn=MydB"

    Set rsName = dbIP.Execute("Select Username From MyLogin")
    Set rsPwd = dbIP.Execute("Select Password From MyLogin")

    If rsName.Fields("Username").Value = strName And rsPwd.Fields("Password").Value = strPass Then
    Me.Hide
    MySplash.Show

    Else
    On Error GoTo ErrorHandler

    ErrorHandler:
    MsgBox ("Invalid Username or Password!")

    End If

    dbIP.Close

    End Sub


    Code for the Main:

    Private Sub Form_Load()

    'List Groups
    With cboGroups
    .List(0) = "Group 01"
    .List(1) = "Group 02"
    .List(2) = "Group 03"
    .List(3) = "Group 04"
    .List(4) = "Group 05"
    .List(5) = "Group 06"
    .Text = "Groups"


    End With

    End Sub


    Code for the splash screen:

    Private Sub Form_Load()

    ShockwaveFlash1.ScaleMode = 3 'play movie in actual size
    ShockwaveFlash1.Movie = "C:\Ivan2.swf"

    Me.Hide
    Main.Show

    End Sub


    So after the login has been confirm, the splash screen is suppose to play, and after the splash screen has been played, then the splash screen will close. Thereafter, the Main page will show. Tats the flow.
    Last edited by iori85z; Sep 28th, 2004 at 01:00 AM.

  12. #12
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424

    try this

    VB Code:
    1. Code for the splash screen:
    2.  
    3. Private Sub Form_Load()
    4.     Me.Show
    5.     ShockwaveFlash1.ScaleMode = 3 'play movie in actual size
    6.     ShockwaveFlash1.Movie = "C:\Ivan2.swf"
    7.     Main.Show
    8. End Sub

  13. #13

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    60
    Nope, tat dosen't work, the splash screen still pop up the same time as the main screen. I think I forgot to post 1 code, I'll edit my previous code.

  14. #14
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424

    ok, i got ur problem and here is the solution

    drop a timer control on form where u have the flash control
    VB Code:
    1. Private Sub Form_Load()
    2.     Timer1.Interval = 100
    3.     ShockwaveFlash1.Loop = False
    4.     ShockwaveFlash1.ScaleMode = 3
    5.     ShockwaveFlash1.Movie = "C:\Inetpub\wwwroot\DoctorDetails\images\animated_text.swf"
    6. End Sub
    7.  
    8. Private Sub Timer1_Timer()
    9.     If ShockwaveFlash1.Playing = False Then
    10.         Unload Me
    11.         Main.Show
    12.     End If
    13. End Sub

  15. #15

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    60
    OK, I will try the timer now.

  16. #16

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    60
    Oh ok, looks like I've to add a timer to make it works, haha, thanks for ur help.

  17. #17
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918
    Or as an alternative without using a timer control:
    VB Code:
    1. Private Sub Form_Load()
    2.    
    3.     Show
    4.     DoEvents
    5.    
    6.     ShockwaveFlash1.Loop = False
    7.     ShockwaveFlash1.ScaleMode = 3
    8.     ShockwaveFlash1.Movie = "C:\YourMovie.swf"
    9.     Do While ShockwaveFlash1.Playing
    10.         DoEvents
    11.     Loop
    12.    
    13.     frmMain.Show    ' Display your main form
    14.     Unload Me       ' Unload the splash form
    15.    
    16. End Sub
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width