Forums: Flash:

 

loadMovie attachBitmap transparent

first
 

JLM loadMovie attachBitmap transparent

I am trying to copy some some text from the parent movie to a loaded in child in AS2/flash8, but for some reason it won't copy transparent even though the copyied bitmap is? Ideas??? Both should be on the same domain I am testing locally, it seems to work if I just copy into a child movie that was created in the parent rather than loaded and then created in.


// method: copyToBitmap
// used for copying a movie to a bitmapdata object
private function copyToBitmapWithTransparency( mc : MovieClip ): BitmapData
{

var bitmap = new BitmapData( mc._width+4, mc._height, true, 0x00000000 );
bitmap.draw( mc );
var rectangle:Rectangle = new Rectangle( 0 , 0, mc._width+4, mc._height );
bitmap.copyPixels( bitmap, rectangle, rectangle, bitmap, bitmap, false );

return bitmap

}

// left generic so pass parameters in
private function copyMc( from: MovieClip, to: MovieClip ):Void
{

var bitmap = copyToBitmapWithTransparency( from );
to.attachBitmap( bitmap, to.getNextHighestDepth() ,"auto", true );


}

 

mystic_juju

well i don't understand this line: "bitmap.attachBitmap(_mc)", but i think your last parameter on the copypixels should be true. haven't tested the code, but check if that makes a difference.

A tale that begins with a beet will end with the devil
quote
 

JLM

Sorry I have removed that line above I was testing something and left it in.
The copyPixel thing I noticed the false thing, i think it is ok because I am using the image as a mask for its transparency, but either way it works fine when copied in the host movie.

for instance in this code if I change _scope to _root the copy code works fine.


private function makeHolder( x: Number, y: Number ):Void
{
//_scope.cacheAsBitmap = true;
var d: Number = _scope.getNextHighestDepth();
_mc = _scope.createEmptyMovieClip('_mc' + _scope._name + d , d );
_mc._x = x;
_mc._y = y;

}


along the lines of

makeHolder( _x, _y );
copySign( _sign, 'Test text', _mc );

copySign just adjusts the 9grid sign when text is autosized before using the copyMc above.

I think I will just have to copy just the text in the sign to a sign in the loaded movie and then adjust the loaded movies sign to fit, but it is anoying to have to jump though hoops for something this simple.

 

JLM

I fixed it, I was placing it off the side of my tile so it was not anything to do with the bitmapData copying.

 
first
 

Forums: Flash: loadMovie attachBitmap transparent

 
New Post
 
You must be logged in to post