A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: bitmapData

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

    bitmapData

    How would I use the bitmapData object to copy a vector image?

    BitmapData.loadBitmap(linkageId);

    where the linkageId is a movie clip in the library which has vector graphics in it, not bitmaps?

    doesn't seem to work.

    thanks for any advise.

    boombanguk

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You need to attach it to a movieclip.

    PHP Code:
    import flash.display.BitmapData;

    var 
    linkageId:String "libraryBitmap";
    var 
    myBitmapData:BitmapData BitmapData.loadBitmap(linkageId);
    trace(myBitmapData instanceof BitmapData); // true

    var mc:MovieClip this.createEmptyMovieClip("mc"this.getNextHighestDepth());
    mc.attachBitmap(myBitmapDatathis.getNextHighestDepth()); 
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194
    thats exactly the code I used and it didn't work.

    I stuck a load of vector squares inside a movie clip, and that was the string name I used in the above code, and it traced as false...

    the only way it seemed to work was when the linkID was an actual bitmap

    any ideas??

  4. #4
    Member
    Join Date
    Oct 2000
    Location
    Lansing, Michigan
    Posts
    79
    You have to use the draw method for a bitmapData object to make a copy of a MovieClip/Textfield. You can only use the linkID on bitmaps in your library with the loadBitmap method.

  5. #5
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194
    I thought it would be the draw method, but i looked at that, and it only takes a bitmapData object again the same problem??

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    That is true, but you can create a transparent Bitmapdata, which nobody sees and place it anywhere you want. Then you place the movieclip to be drawn outside your movie.
    PHP Code:
    import flash.display.BitmapData;
    import flash.geom.Rectangle;
    import flash.geom.Matrix;
    import flash.geom.ColorTransform;
    var 
    myBitmapData:BitmapData = new BitmapData (10080true);
    var 
    mc_1:MovieClip this.createEmptyMovieClip ("mc"this.getNextHighestDepth ());
    mc_1.attachBitmap (myBitmapDatathis.getNextHighestDepth ());
    mc_1._x 200;
    mc_1._y 200;
    var 
    mc_2:MovieClip clip;
    var 
    myMatrix:Matrix = new Matrix ();
    myMatrix.rotate (Math.PI 2);
    var 
    translateMatrix:Matrix = new Matrix ();
    translateMatrix.translate (7015);
    myMatrix.concat (translateMatrix);
    var 
    myColorTransform:ColorTransform = new ColorTransform (0011002550);
    var 
    blendMode:String "normal";
    clip_2.onPress = function ()
    {
        
    myBitmapData.draw (mc_2myMatrixmyColorTransformblendMode);
    }; 
    - The right of the People to create Flash movies shall not be infringed. -

  7. #7
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194
    trying to understand your code.

    clip is a Mc in the library only? or its already placed on the stage?? tried both, neither worked.

  8. #8
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    clip is on stage but placed outside. See attachment.
    Attached Files Attached Files
    - The right of the People to create Flash movies shall not be infringed. -

  9. #9
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194
    ok just had a look at that.

    it just creates a blue rectangle...what I need though is for it to put on the screen a vector square which is in a clip, which ideally is in the library, not already on the stage......can't this be done using the bitmapData object??

  10. #10
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194
    the reason im asking this, is because I'm using a scroll engine that uses the bitmapData object, but insted of using bitmap tiles I want to use vector tiles..

  11. #11
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Ok, use the example i posted. Delete clip from stage and create linkage with clip as identifier. Then modify the script by adding these two lines:

    var mc_2:MovieClip = this.attachMovie("clip","clip",this.getNextHighest Depth());
    mc_2._visible = false;

    Whatever the new object will look like you need to set in the draw method.
    - The right of the People to create Flash movies shall not be infringed. -

  12. #12
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194
    did that, it still just plots a blue rectangle...??

    also does that mean to use the draw method it has to use an instance ? and can't just use one from the library??

  13. #13
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    It cannot just take an clip from the library (to my knowledge ), but needs to place an instance on stage. The blue rectangle is just what has been coded by the draw method. You can manipulate that as you like.
    - The right of the People to create Flash movies shall not be infringed. -

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