[mtasc] Using png in BitmapData

Nicolas Diez nicolas.diez at gmail.com
Thu Sep 1 23:14:55 CEST 2005


Ok, I see. I will do that with setpixel as it is esay to copy an image
into BitmapData with a Java or C file writing the file with this
function.
On 9/1/05, Austin Haas <austin at pettomato.com> wrote:
> Babelfish translation:
> 
> his it is a simple affluent example that uses two new functions. First
> attachBitmap that is part of the MovieClip class and allows us to adhere
> (attach) bitmap to movieclip, is similar to attachMovie but it does with
> bitmaps. The other function is loadBitmap that allows us to load an
> image that this in the bookstore to the memory. In this case I have a
> png png in the bookstore in the bookstore that in "linkage" this
> exported for ActionScript with the name "circle.png". Soon I have the
> following code in first frame:
> import flash.display.BitmapData;
> to var btmp:BitmapData = BitmapData.loadBitmap("circle.png");
> 
> to var level = 0;
> 
> this.onMouseDown = function()
> {
>     to var paper clip = this.createEmptyMovieClip("bmp"+level, level++);
>     clip.attachBitmap(btmp, 0, "car", true);
>     clip._x = _ xmouse - clip._width/2;
>     clip._y = _ ymouse - clip._height/2;
> }
> 
> It's like I said. He has the png already in the library ("bookstore").
> He assigns it a linkageID, then uses attachBitmap. This is not possible
> in the current Flash IDE (giving a linkageID to a bitmap), but will be
> available in Flash 8. I don't believe there is any way to add anything
> to the library with just MTASC, but perhaps with swfmill? I've never
> used swfmill, so I can't say.
> 
> This guy might have a beta version of the new IDE.
> 
> -austin
> 
> Nicolas Diez wrote:
> > Well, in fact, it seems possible at this page :
> > http://www.asfusion.com/blog/entry/attachbitmap-y-loadbitmap-en-flash-8
> >
> > But I'm not speaking spanish at all and I don't understand how to add
> > the png file to the Library.
> >
> > On 9/1/05, Austin Haas <austin at pettomato.com> wrote:
> >
> >>The argument for BitmapData.loadBitmap is a linkageID, set in the
> >>library, not a path. You can't load a bitmap external to the swf. I
> >>think you have to wait until the new Flash IDE comes out to use
> >>BitmapData.loadBitmap.
> >>
> >>The only way you can load bitmaps dynamically right now is with
> >>movieclip.loadMovie(). But, I don't think you can convert those to a
> >>BitmapData object.
> >>
> >>-austin
> >>
> >>Nicolas Diez wrote:
> >>
> >>>Hello, I've read that png files are supported via the
> >>>BitmapData.loadBitmap() method.
> >>>So, in order to make my banner with flash 8 feature (I think of
> >>>perlinnoise), I wrote a little script to see if the image was loaded
> >>>into the movie. The code for this script is :
> >>>
> >>>///////////////////
> >>>import flash.display.BitmapData;
> >>>class Test
> >>>{
> >>>    function Test()
> >>>    {
> >>>        var mc:MovieClip = _root.createEmptyMovieClip( "myClip", 1 );
> >>>        var banner:BitmapData = BitmapData.loadBitmap("header.png");
> >>>        mc.attachBitmap(banner);
> >>>    }
> >>>
> >>>    static function main()
> >>>    {
> >>>        var temp = new Test();
> >>>    }
> >>>}
> >>>////////////////////
> >>>An I call mtasc with this command line :
> >>>snoopy:~ nico$ Desktop/compilateur_as2/bin/mtasc -header 800:117:25
> >>>-main -version 8 Test.as -swf Desktop/compilateur_as2/bin/Test.swf -cp
> >>>Desktop/compilateur_as2/ocaml/mtasc/std -v
> >>>
> >>>I am using mac OSX Tiger v10.4.2, mtasc 1.09, ocaml 3.08.4. I compiled
> >>>mtasc, uses some sample on the web to test and it works. I also have
> >>>the flash player 8 in beta version in order to test swf with Safari. I
> >>>don't understand what I'm doing wrong here. Is there something in the
> >>>command line ?
> >>>--
> >>>MTASC : no more coffee break while compiling
> >>>
> >>
> >>--
> >>MTASC : no more coffee break while compiling
> >>
> >
> > --
> > MTASC : no more coffee break while compiling
> >
> --
> MTASC : no more coffee break while compiling
>



More information about the mtasc mailing list