Elemenop, What you were probably doing is loading the data directly into the memblock from your 'x' object or bitmap etc, but the data needs to be in memblock format in the first place.
Here's example code for you to try:
` Just make a crappy little image for texturing
cls rgb(255,255,255)
get image 1,0,0,1,1
cls 0
rem Preparation stage - you would do this in a separate program
rem to convert all your meshes, images, sounds etc into
rem their memblock formats.
` Load the example mesh, and convert it to memblock format
load mesh "example.x", 1
make memblock from mesh 1, 1
` Save the memblock to disk for later
SaveMemblock(1, "example.mesh")
` Clean up to prove the later parts work ;)
delete memblock 1
delete mesh 1
rem Doing something stage - this would go in your app/game
rem to load the data from disk and reconstitute it
` Queue the item for loading
Handle = add item to queue( "example.mesh" )
` Wait until it loads - could be doing something else here
while not check queued item loaded( Handle )
wait 0
endwhile
` Get the loaded item into a memblock
load queued item to memblock Handle, 1
`LoadMemblock(1, "SaveForLater.mesh")
` Remove the loaded item ... unless you need it again
delete queued item Handle
` Make an object from the loaded data
make mesh from memblock 1,1
make object 1,1,1
` Clean up again
delete memblock 1
delete mesh 1
wait key
end
rem Supporting functions
function SaveMemblock(MB as integer, Filename as string)
local i as integer
local s as integer
if file exist(Filename) then delete file Filename
open to write 1, Filename
s=get memblock size(MB)-1
for i=0 to s
write byte 1, memblock byte(MB, i)
next i
close file 1
endfunction
function LoadMemblock(MB as integer, Filename as string)
open to read 1, Filename
make memblock from file 1, MB
close file 1
endfunction
The file 'example.x' should be created using wordpad from the data I've put into the Code button.