A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: adding a bitmap graphic to a movieclip in as3 code

  1. #1
    Member
    Join Date
    Apr 2008
    Posts
    30

    adding a bitmap graphic to a movieclip in as3 code

    Hi, I'm new to as3 and programming and I'm trying to add a bitmap to a movie clip in code. However, I'm having trouble getting the bitmap location to go where I want it because it's inside the movieclip and it just shows up at 0,0 of the movieclip instead of the coordinates I want it to be: Here's some of code so you can see what I mean:

    imageBitmapData3 = new Lander(63, 53);

    _player = new Bitmap(imageBitmapData3);

    _gameLevel.addChild(_player);
    _player.x = 145;
    _player.y = 90;

    -Instead of showing up at 145, 90 It just shows up at the movieclip, _gamelevel, 0,0.


    does anyone know how I could get it to do what I want it to do? I want to add it inside the mc because I need everything to move with the _gameLevel background when I move it.

    Thanks

  2. #2
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    can't be sure what Lander is, but assuming it's a valid BitmapData object, what you have should be fine.

  3. #3
    Member
    Join Date
    Apr 2008
    Posts
    30
    Lander is what I named the class for the field in the Linkage Properties box for the bitmap. Like I said it shows up at 0,0 instead of 145,90. I just tried just adding the bitmap as addChild(_player) without the _gameLevel in front of it and it does the same thing, shows up at 0,0. I can't figure out why.
    Last edited by WEich1213; 12-01-2010 at 03:39 PM.

  4. #4
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    you must be setting the position elsewhere... i just duplicated that setup exactly (added an image to the library, gave it a class name of Lander, and pasted your code with some var declarations), and it works fine.

  5. #5
    Member
    Join Date
    Apr 2008
    Posts
    30
    ok thanks

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