12 Replies Latest reply on Dec 28, 2007 2:28 AM by Greg Dove

    Loading BMP dynamically ?? HELP??


      Hi all,

      I have a problem. I can load JPG using the imageloader component but not BMP's. Using mc.loadMovie i can load JPG's and not BMP's. How can i load bmp in flash using programming??

      Another doubt, Can i get image data from some other program? Is there a draw API which can draw an image data which is in RAM?? Suppose if i get an image data in RAM, can i draw it in flash stage??

      Please help me out with these doubts!!

      Regards
      Roshan
        • 1. Re: Loading BMP dynamically ?? HELP??
          dr_ross Level 1
          I guess as you're using loadMovie your currently authoring for flash 8 or below, in which case you can only load SWF, JPEG, GIF, or PNG files.
          If in doubt check the help file under loadMovie.

          Just do a quick photoshop or flash jsfl script to convert all the images you want to load into png's
          • 2. Re: Loading BMP dynamically ?? HELP??
            Level 1
            Hi,
            How can I use JSFL flash to convert bmp to PNG? Im not good at this part. Can flash convert from BMP to jpg or gif?? If so i can load those with the loader right??

            Regards
            Roshan
            • 3. Re: Loading BMP dynamically ?? HELP??
              kglad Adobe Community Professional & MVP
              jsfl won't help you convert file types and flash can't convert file types.
              • 4. Loading BMP dynamically ?? HELP??
                Greg Dove Level 4
                kglad: in flash you can use the export->export image option in the file menu to convert what's on stage to a different image format, including bmp, so I presume you could actuallly code something in jsfl to do that. But I think flash would be a poor choice to use for running batch jobs like this. I'd use fireworks, because I have it, but I'm sure there are plenty of choices for batch processing image conversions via image editing programs that offer this, including open source/free options (e.g. I'd be surprised if the GIMP editor didn't also provide this type of functionality).
                • 5. Re: Loading BMP dynamically ?? HELP??
                  Level 1
                  Hi Friends,

                  Is there any way i can load BMP programatically? Im taking data, i.e BMP's from the output of a MFC program and MFC outputs only BMP's. Imageloader in flash doesnt recognise BMP's. I dint get the JSFL thing you were describing. Im new to that part. I knwo about photoshop script to run batch processes, but i just need to load BMP ryt? So do i need to use JSFL and all?/ im bit confused friends. sorry.

                  Regards
                  Roshan
                  • 6. Re: Loading BMP dynamically ?? HELP??
                    kglad Adobe Community Professional & MVP
                    i don't think you can. gwd may think otherwise.
                    • 7. Re: Loading BMP dynamically ?? HELP??
                      Greg Dove Level 4
                      Perhaps I need to clarify:

                      Briefly: Perhaps you could use Flash to do it, but even if you could it doesn't make sense (to me). And you cannot use the Flash Player to do it.

                      FLASH vs. FLASH player
                      Flash
                      When I'm referring to Flash, I'm referring to the authoring tool.
                      You can load a .bmp file manually into Flash (the authoring tool). You can also manually export as different image formats from the authoring tool. And you can write scripts in jsfl, which is the language that you use to automate and/or extend functionality in Flash, the authoring tool. So simply on the basis of this combination of supported functions, I presume you could write something in jsfl to perform something similar to the batch processing functionality of other image editing programs, although I can't confirm because I've not tried to do it specifically. (I was just suggesting this to you earlier kglad -mainly in repsonse to your comment that flash can't convert file types - and not saying it was definitely possible). But like I said, even if you could do it this way I just don't think it makes sense, because there are plenty of other image editing tools that would do the same thing without any extra coding. And if you were doing this on a server, you could also, for example, use the image manipulation extensions of a server scripting language.. e.g. Imagick in PHP for example to perform conversions.

                      Flash Player
                      You cannot load a .bmp file in the flash player and have it interpreted as an image. (It might be possible perhaps in as3 by interpreting the file data, but it would still make not make a lot of sense - it would be best to compress the image in another format before loading it in flash)

                      I think this is what Dr Ross was saying earlier. You can't load a bmp into the player. But you could use some image editing tool with a batch processing script to convert them all. The jsfl stuff was just related to whether this activity was possible in flash (the authoring tool).

                      If you want this fully 'automated' and do not intend to manually change all the .bmps to jpegs or .pngs for example by running them through an image processing script in an image editing application then you will need to change the way they are ouput from your application or use another server side script to do the intermediate step for the conversions - if you are stuck with the .bmp output from your MFC program.
                      • 8. Re: Loading BMP dynamically ?? HELP??
                        dr_ross Level 1
                        Anyway guys i did suggest the use of photoshop first, but without knowing what programs you had installed and it being a pretty sure bet you had flash installed i sugested the jsfl route.

                        If anyones unsure of how this could be done i've stripped some code out of a full jsfl app that should do the job.

                        It'l convert any folder of image files passed to pngs and save them in the second folder

                        http://www.savefile.com/files/1286427

                        if you have flash installed just double click to run, BEWARE though that as its far from the full thing theres no cancel once you've started so be sure you have the right target folder.

                        Laters, DrRoss
                        • 9. Re: Loading BMP dynamically ?? HELP??
                          Level 1
                          Hi DrRoss,

                          I got the point. Using JSFL, i could convert bmp to PNG, really cool. Now how can i execute it with actionscript? MMExecute needs it to be saved in the WindowSWF folder and stuff like that. Is there an easy way out, so that anytime i can convert files on a button click, or onEnterframe()??

                          Regards
                          Roshan
                          • 10. Re: Loading BMP dynamically ?? HELP??
                            Greg Dove Level 4
                            @dr ross: thanks for sharing that jsfl script. Its been a couple of years since I did anything substantial with jsfl, I'm pretty sure I could code more in it now. Understand your point about flash installation being a 'given' in terms of recommending jsfl as a valid option in the original. Didn't think of it that way before.

                            Roshan/Nirvana: To repeat:There is no way to do this directly from actionscript in the flash player. This only works in the flash authoring tool.
                            • 11. Re: Loading BMP dynamically ?? HELP??
                              Level 1
                              Hi GWD and Dr.Ross,


                              It was great communicating with you. Hope ADOBE soon incorporate BMP loading programatically, like "loadBMP" or something so that our work on BMP's can be easier. Thanks a million for all the discussion and feedback. I and GWD came to know more on JSFL. Something is added to our knowledge account though.

                              Thanks once again....... hope this section has given us all an insight. what do you say, GWD?

                              Regards
                              Roshan

                              • 12. Re: Loading BMP dynamically ?? HELP??
                                Greg Dove Level 4
                                I seriously doubt whether the flash player will receive .bmp format native loading support - it doesn't make sense for it to be a priority (its uncompressed, and I think its a MS only format).
                                But like I said earlier if it was essential I think it would be possible to code something in as3 to do it.
                                If I was you I would concentrate on converting the image outside of flash, via server scripting (e.g. in php) if your app is running on a webserver and not locally.