This content has been marked as final. Show 8 replies
Not with getNetText(), but with preloadNetThing()
nID = preloadNetThing("URL")
-- ... wait for netDone() to return TRUE
tMember = _movie.newMember(#bitmap)
tMember.filename = "URL" -- see above
-- check filename assignment
if tMember.type <> #bitmap then exit
tImage = tMember.image.duplicate()
-- optionally delete member:
-- continue with image manipulation ...
Thanks for the reply, Sean! I should have been more specific. The data I am loading is not an image file. It is a string. I am loading a file with 3 images compressed together. Then decompressing it using lingo into a string. Then I want to use that string to draw my bitmap using copypixels. I can do it buy going through and using setpixel to draw each pixel. But that's too slow. I want to use copypixels.
Can you give more information - how is the file compressed/created? You may need to write it to a temp file and decompress that to temp as well, then load the images in as images & delete the temps
the major problem is that copyPixels works with image objects... you need to have two image objects in Director.... there's no problem with this part of your pseudocode:
img = image(200, 200, 32)
but there's a bunch of steps not showing here:
img = String(myData)
and, in fact, that line simply shows the data being converted to a string. It has to get into an image object before copyPixels can be used, ie. if you import an image into a cast member by using importFileInto() or the .fileName parameter of a member then you will have your image object in Director ready to manipulate with copyPixels.
Hey, Chunick. Thanks for your reply and for the link. You have a lot of awesome examples and I bookmarked that page. What you suggested totally makes sense. But I'm afraid that I was unclear about what I am trying to do. What I would like to do is this:
Have information sent over the server (such as Flash Media Server). Decompress that information using an algorythm such as GZip. Make it into 3 separate images. Copy those images onto the screen.
Since I may not even be dealing with a file, I can't just use the .fileName property. Also, I need to parse the data before it's usable as image data.
Why do I want to do this??? Well, what I am trying to do is make a 4-way scroller using a tilemap. Each tile needs to load: an 8-bit alpha channel, an 1-bit bitmask, a 24-bit image. Then they are used to create the tile, using the alpha channel for the shape, the image for the colors, and the bitmask for walkability. I need those items to load IN THAT ORDER so that I can at least draw the shape and get the walkability even if the tile hasn't compeletly loaded yet. I wanted to compress them all together to make things smaller.
Maybe I am just asking too much lol! Isn't there a way to just convert a string of data into an imageobject? Thanks for any help.
What if you saved the images in a castLib and published it as a shockwave cct. The file size would be small and you could download a single file and link to it to pull the images.
Thanks, McFazstp. I am trying that and it seems to work pretty good. It compresses everything to be small and loads how I want. Thanks!!!
glad to see McFazstp's excellent suggestion is working for you. Good luck on the project.