A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] bitmapData's dimensions (width and height)

  1. #1
    Member
    Join Date
    Jun 2011
    Posts
    85

    resolved [RESOLVED] bitmapData's dimensions (width and height)

    Hi,

    I'm new to flex and I have a question concerning bitmapData and its width and height.

    Normally you set up bitmapData like this in AS3:

    Code:
    var bd:BitmapData = new BitmapData(100, 100, true, 0x00000000);
    var bm:Bitmap = new Bitmap(bd);
    But in Flex embedding an an image works like this:

    Code:
    [Embed(source="../../../../../assets/sprites/asteroids/asteroid_32_full.gif")]
    public static const Asteroid1:Class;
    var imageBM:Bitmap = new Library.Asteroid1();
    When using the bitmapData (e.g. imageBM.bitmapData) I don't have to set up width and height any more. Does the Flash player know the width and height of a bitmapData automatically even when NOT setting up the bitmapData's width and height? I'm totally unaware about this topic because I don't know whether the Flash player always knows the dimensions of a bitmapData. Could this cause problems when not setting up the dimensions of a bitmapData? Thank you very much.

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    In your example above, Asteroid1 I'd actually a subclass of Bitmap which is constructed at compile time to include the image resource you are embedding. It knows the dimensions because they are embedded in the file format and the compiler knows how to get them.

  3. #3
    Member
    Join Date
    Jun 2011
    Posts
    85
    Ok, cool. Thank you very much!

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