Click to See Complete Forum and Search --> : duplicating of loaded .swf's


Boombanguk
08-10-2005, 04:33 PM
Hi,

quick question, can flash 8, duplicate loaded in movies with actionscript?

boombanguk

FlashGuru
08-10-2005, 05:21 PM
Nope, but you can load a movie, then draw it into a bitmap.

Boombanguk
08-10-2005, 05:53 PM
if you do that, can you duplicate the bitmap? and if so what are the performance issues?

FlashGuru
08-10-2005, 06:12 PM
Sure you can duplicate the bitmap as many times as you like using BitmapData.clone(), memory permitting. There is also a size limit for bitmaps in the player, including bitmap caching, they cant be bigger than 2880 pixels in either direction (width or height) as this uses 32mb of ram.

4 bytes per pixel (1 byte per channel - ARGB) * 2880 * 2880

tonypa
08-12-2005, 07:18 AM
Let me see if I understand this correctly.

You load swf into movie clip "mc1" using loadMovie.
You turn it into bitmap (somehow, probably by magic).
You can now duplicate this bitmap into any other movie clip?

gSOLO_01
08-12-2005, 09:03 AM
Yes you can tonypa. You don't actually turn 'mc1' into a bitmap, you just create the BitmapData object from it. Here's quick and simple example:

http://gsolo.com/temp/macromedia/flash/8ball/duplicatecoloredbox.html

I load the swf on the left. When you click the button I attach the BitmapData from the loaded swf onto the yellow MovieClip next to it.

csdstudio
08-12-2005, 10:02 AM
I've created a page layout application and the client is able to save files in a database. I've been looking for a way to view a thumbnail of the said file in the file manager. I can see creating a BitmapData clip, sort of a snapshot of the page layout, but wonder if there is a way to export that data from flash.

Boombanguk
08-12-2005, 11:53 AM
for gsolo: but thats a vector its creating the bitmapdata from? could you do the same with a bitmap loaded in?

audas
08-12-2005, 12:07 PM
ohhhh,.......you're freaking me out !
Is this a bit map, or simply called a bit map.
Is can the pixel data be exported and actually stored externally as a bit map.
Can the file upload function firect the newly created bitmap to be saved ?

gSOLO_01
08-12-2005, 12:11 PM
It could have been be a jpg, png, gif, library item or whatever.

csdstudio
08-12-2005, 02:40 PM
For gSOLO: Any idea whether I can export the data from the bitmapdata out from flash? I use flash remoting frequently and would transfer the data to sql.

cancerinform
08-12-2005, 03:01 PM
What is the sense of creating a bitmap of an swf and duplicating that?

Just a question, since it is not a movie any more.

Boombanguk
08-12-2005, 05:28 PM
for canderinform: Flash has never been able to duplicate loaded in .swfs, so you might want to load in say a picture of a flower in a .swf and have a 100 of them on screen, you would need to load the .swf in 100 times! because you couldnt' duplicate the clip itself, and the reason you couldnt' do that is because it didn't exist in the parents library, but maybe now with this bitmap thing its possible, which opens up lots of doors that Flash was never able to enter.
what im still interested in though is the performace hit of this, how much is the Flash movie going to slow down, is it creating this bitmap in real time? or creating it and then it can be cached?

csdstudio
08-12-2005, 06:11 PM
It will be cached to ram, that's the key. It would take as much ram to display 100 loaded swfs as it would to duplicate that swf 100 times via bitmapdata.clone(). Same amount of raw data is needed at runtime in the flash player.

tonypa
08-13-2005, 08:19 AM
Lets say the loaded swf has several frames. In frame1 it has red circle, in frame2 it has blue triangle, in frame3 it has yellow rectangle. Is it possible to choose which of the frames is duplicated using bitmap? Also, once the bitmap is cloned into other mc, what exactly is that "bitmap", is it exactly same thing as if gif/jpg was placed there?

sand858
08-17-2005, 03:49 PM
My understanding (which is limited), is that the movie clip that is bitmapData-irized has only the current frame made into the bitmapData essentially making bitmapData largely useless for trying to accomplish what I think this thread was about (the ability to duplicate loaded movie clips without restriction). You could theoretically simulate a multi-framed loaded movie clip, but at that point you're probably better off just importing external jgps (and legend has it 8 supports gif/pngs,etc.).

It seems that for us who want to attach dynamic movie clips (with functions, frames and other complex behaviors), we are stuck using the current hacks...

tomsamson
08-17-2005, 04:10 PM
tony,you draw the currently visible graphics of the mc into a bmpodata object,nothing more,nothing less. you can attach a bitmapdata object to any mc,so once you´ve attached it to an mc,you can access it like you would access any other object in that clip.
its not the same thing having a bitmapdta object in an mc like having a jpg in an mc.
sure,both can look the same (as they (can) feature the same graphic) but a bitmapodata object is derived from a built in flash class and as the other built in classess it has many properties and methods you can use.

YWNM
08-17-2005, 05:09 PM
It could have been be a jpg, png, gif, library item or whatever.

So then how do I save it as a JPG to the hard drive? Will I need to use the PHP GD Library? I've been wanting to be able to do this for a while now.

Is this a Flash 8 function or just one I wasn't aware of?

FlashGuru
08-17-2005, 05:15 PM
To save the bitmap out from the Flash Player as a jpeg, you need to send the raw bytes from the bitmap over to php or whatever and have it compress the bitmap into a jpeg.

sherif79
03-21-2006, 06:16 AM
but can you get the raw bytes out of a bitmap object using AS 2, flash player 8? I thought that was only still in the macromedia Labs for the moment.

cancerinform
03-21-2006, 09:18 AM
http://www.flash8.flashscript.biz/store_image/store_image.html