[Newbies] How do I load a MovieMorph from a .movie file?

sst stephen.smith at xrayyankeezulu.com
Tue Dec 13 03:50:47 UTC 2011

Hi Everyone,

I'm trying to improve the MovieMorph tutorial to update it to Squeak 4.2. 
I'm stuck on being able to load my .movie file into a new MovieMorph. 

This is the code I have used to create the .movie file from my 3 bitmaps
(frame_001.bmp, ...):

| frameCounter frameCount frame32Bitmap movieFile animationFrame |
movieFile := FileStream newFileNamed: 'buddies.movie'.
movieFile binary.
animationFrame := Form extent: 100 at 100 depth: 32.
#(22 100 100 32 3 100000) , (7 to: 32)
        do: [:i | movieFile nextInt32Put: i].
1 to: 3 do: [
        :i | frameCounter := i printString. frameCount := frameCounter
padded: #left to: 3 with: $0.
        frame32Bitmap := Form fromFileNamed: 'frame_' , frameCount , '.bmp'.
        frame32Bitmap displayOn: animationFrame at: 0 at 0.  "Convert down to
16 bits"
        animationFrame display; writeOnMovie: movieFile].
        movieFile close.

I stole it directly from the current Recipe (on the Squeak wiki) for
creating a Squeak movie.  It runs and creates the buddies.movie file from my
bmp frame images. But I can't figure out how to load the .movie file into
the MovieMorph.

Does anyone know the way to do this?  Or do I have to load each frame
manually? I suspect the clue is in the Form>>writeOnMovie: method but
haven't had any luck figuring it out. I know I have to load in the bits of
the bitmap somehow ...

I was expecting to be able to write something like this (I know, loadMovie:
doesn't exist - it just seems like what one would expect to see):

m := MovieMorph new.
m loadMovie: (FileStream fileNamed: 'buddies.movie').
m openInWorld

View this message in context: http://forum.world.st/How-do-I-load-a-MovieMorph-from-a-movie-file-tp4188664p4188664.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.

More information about the Beginners mailing list