Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-04-2004, 03:02 AM
Junior Member
 
Join Date: Nov 2004
Posts: 1
Default Mingx crashes my app with this code.

I have 112 jpeg files in a folder and I want to make an swf out of them.

I've got code that works and I figured out how to do it without crashing, but I'm wondering why the previous code that I had did not work.

Basically, it seems that if I don't keep a reference to each Bitmap and Input object that is added to the movie, when I save the movie it crashes.

Here is the code that works (I have an array of 112 inputs and Bitmaps):

Code:
Private Sub jpg2swf2()
    Dim oMov As MINGXLib.Movie: Set oMov = New MINGXLib.Movie
    Dim aInput(1 To 112) As MINGXLib.input
    Dim aFrame(1 To 112) As MINGXLib.Bitmap
    
    Dim i&
    
    With oMov
        
        .Create
        .SetDimension 800, 600
        .SetRate 4
        
        For i = 1 To 112
            Set aInput(i) = New MINGXLib.input
            Set aFrame(i) = New MINGXLib.Bitmap
            aInput(i).Create "C:\Temp\1 jpg\vnc" & i & ".jpg"
            aFrame(i).Create aInput(i)
            .Add aFrame(i)
            .NextFrame
        Next
    
    End With
    
    oMov.Save "C:\Temp\1 jpg\vnc.swf"
End Sub
Here is the code that does not work (using the same oFrame reference over and over). Can anyone tell me why? My guess is that the movie object only holds a pointer to each object that is added and does not add a COM reference with AddRef. Is this correct?

Code:
Private Sub jpg2swf()
    Dim oMov As MINGXLib.Movie
    Set oMov = New MINGXLib.Movie
    
    Dim oFrame As MINGXLib.Bitmap
    
    Dim i&
    
    With oMov
        
        .Create
        .SetDimension 800, 600
        .SetRate 4
        
        For i = 1 To 112
            FrameLoad "C:\Temp\1 jpg\vnc" & i & ".jpg", oFrame
            .Add oFrame
            .NextFrame
        Next
    
    End With
    
    oMov.Save "C:\Temp\1 jpg\vnc.swf" ' Crash happens here.
End Sub

Private Sub FrameLoad(sFile As String, oFrame As MINGXLib.Bitmap)
    
    Dim oInput As MINGXLib.input
    Set oInput = New MINGXLib.input
    
    Set oFrame = New MINGXLib.Bitmap
    
    oInput.Create sFile
    oFrame.Create oInput
    
End Sub
Thanks.
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:32 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.