prev | index | next

MX - ImageStream
6
15
82363 bytes
1467 bytes
2007-10-09 21:14:43
2007-10-26 02:33:40
Oldes (oliva.david@seznam.cz)


ImageStream key word creates Sprite with sequence of images on each frame. You can also define action for first, last and each frame and use lit-words: 'streamImageNumber 'streamImageSpriteId 'streamImageBitmapId to get value of exported linkage IDs for bitmap and sprite with an image.

If you want to try this script at home, change the path of the directory.

(mx-imagestream.rswf)

background 0.0.0
require %includes/txt_info.rswf

spr_photos: imageStream %/I/rebol/rs/projects-rswf/danca-ryba/latest/danca_200/ 200x145 [
    name "danca"
    onFirstFrame [
        if cycle > 9 [cycle: 1]
        _root.info: "this is first frame"
        ;note that the message will not be visible
        ;it will be overwritten by onEachFrame call which will be also processed 
    ]
    onEachFrame [
        _root.info: reform [
            "cycle:" cycle
            'streamImageSpriteId
            'streamImageBitmapId
            'lastBitmapWidth
            'lastBitmapHeight
        ]
    ]
    onLastFrame [
        cycle++
    ]
    ;firstFrameEmpty ;<- uncomment this if you want to leave first frame empty
    ;noPlace ;<- uncomment this if you don't want to place images on scene
]
photos: place spr_photos [
    at 30x30
    actions [
        load    [cycle: 1   ] ;<- this action is called only once
        press   [this.stop()]
        release [this.play()]
    ]
]
showFrame end