263 posts
  • Has been part of the Envato Community for over 6 years
  • Located in Antarctica
  • Has sold $100+ on Envato Market
  • Has collected 1+ items on Envato Market
+1 more
x360c says

I don’t know what’s going on here, but I want a code that clones a MovieClip as Bitmap. Sounds easy? Nope.

Here’s the code:
function cloneMovieClip (original:MovieClip){
var tempData=new BitmapData (original.width,original.height,true,0xFFFFFF);
var tempBitmap:Bitmap=new Bitmap (tempData);
tempData.draw (original);
return tempBitmap;
}
Doesn’t work… it’s pushes this error:
ArgumentError: Error #2015: Invalid BitmapData.
    at flash.display::BitmapData$iinit()
    at index_fla::MainTimeline/cloneMovieClip()
    at MethodInfo-302()
So I change it to this:
function cloneMovieClip (original:MovieClip){
var tempData=new BitmapData (50,50,true,0xFFFFFF);
var tempBitmap:Bitmap=new Bitmap (tempData);
tempData.draw (original);
return tempBitmap;
}

And it does work, but I need it dynamic. WHAT THE HECK IS GOING ON ?

755 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+5 more
djankey says
AS2 ? _width, _height
var tempData=new BitmapData (original._width,original._height,true,0xFFFFFF);
2309 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 10+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
+5 more
theflyingtinman says
I don’t know what’s going on here, but I want a code that clones a MovieClip as Bitmap. Sounds easy? Nope. Here’s the code:
function cloneMovieClip (original:MovieClip){
var tempData=new BitmapData (original.width,original.height,true,0xFFFFFF);
var tempBitmap:Bitmap=new Bitmap (tempData);
tempData.draw (original);
return tempBitmap;
}
Doesn’t work… it’s pushes this error:
ArgumentError: Error #2015: Invalid BitmapData.
    at flash.display::BitmapData$iinit()
    at index_fla::MainTimeline/cloneMovieClip()
    at MethodInfo-302()
So I change it to this:
function cloneMovieClip (original:MovieClip){
var tempData=new BitmapData (50,50,true,0xFFFFFF);
var tempBitmap:Bitmap=new Bitmap (tempData);
tempData.draw (original);
return tempBitmap;
}
And it does work, but I need it dynamic. WHAT THE HECK IS GOING ON ?

So when you put your trace statements in to examine the values of original.width & original.height (the only difference between the working function version and the non-working version) and the value of tempData after instantiation, what did it report?

263 posts
  • Has been part of the Envato Community for over 6 years
  • Located in Antarctica
  • Has sold $100+ on Envato Market
  • Has collected 1+ items on Envato Market
+1 more
x360c says

It’s AS3 . The numbers are outputted when traced. I think it’s a bug, but I see examples of this code on the web working. Any more ideas?

2309 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 10+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
+5 more
theflyingtinman says
It’s AS3 . The numbers are outputted when traced. I think it’s a bug, but I see examples of this code on the web working. Any more ideas?

What numbers?

263 posts
  • Has been part of the Envato Community for over 6 years
  • Located in Antarctica
  • Has sold $100+ on Envato Market
  • Has collected 1+ items on Envato Market
+1 more
x360c says

I am an idiot. I forgot BitmapData has a strict limit of width/height not being over 2880 pixels. Urghh! Now I have to find some kind of solution…

2309 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 10+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
+5 more
theflyingtinman says
I am an idiot. I forgot BitmapData has a strict limit of width/height not being over 2880 pixels ….

That is what I was getting at. :)

5398 posts The Dude Abides
  • Located in United States
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has been part of the Envato Community for over 5 years
+9 more
CodingJack says
1389 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+7 more
Pdesignx says

yes flash has 2880 limit… you can not show wider than this.. even when you load with loadMovie or MovlieClipLoader…

1955 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 10+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
Emroni says

I hadnt heard about this limit before, just 2 days ago or something someone posted that on another thread. Why 2880, and why is there a limit to begin with? Can imagine people getting frustrated about it..

Anyway, x360c, why not load it in slices side by side into a movieclip, and then draw that main mc into bitmap? Would that work? Or, bitmap the slices, and use them next to each other every time

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by