A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 21

Thread: duplicating of loaded .swf's

  1. #1
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194

    duplicating of loaded .swf's

    Hi,

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

    boombanguk

  2. #2
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    Nope, but you can load a movie, then draw it into a bitmap.

  3. #3
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194
    if you do that, can you duplicate the bitmap? and if so what are the performance issues?

  4. #4
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    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

  5. #5
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    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?

  6. #6
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,786
    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/fla...oloredbox.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.

  7. #7
    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.

  8. #8
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194
    for gsolo: but thats a vector its creating the bitmapdata from? could you do the same with a bitmap loaded in?

  9. #9
    go blues ! audas's Avatar
    Join Date
    Oct 2000
    Location
    london ,piccadily circus!
    Posts
    665
    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 ?
    peace.

  10. #10
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,786
    It could have been be a jpg, png, gif, library item or whatever.

  11. #11
    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.

  12. #12
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    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.
    - The right of the People to create Flash movies shall not be infringed. -

  13. #13
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194
    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?

  14. #14
    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.

  15. #15
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    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?

  16. #16
    Senior Member sand858's Avatar
    Join Date
    Aug 2001
    Posts
    327
    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...
    gamedozer games
    Free multiplayer and singleplayer games

  17. #17
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    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.

  18. #18
    Senior Member
    Join Date
    Nov 2002
    Location
    Maryland, USA
    Posts
    428
    Quote Originally Posted by gSOLO_01
    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?

  19. #19
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    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.

  20. #20
    Senior Member sherif79's Avatar
    Join Date
    Jan 2001
    Location
    Essex, England
    Posts
    266
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center