263 posts
  • Antarctica
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Sold between 100 and 1 000 dollars
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
  • Beta Tester
  • Bought between 100 and 499 items
  • Croatia
  • Exclusive Author
  • Has been a member for 7-8 years
  • Referred between 50 and 99 users
  • Sold between 50 000 and 100 000 dollars
djankey says
AS2 ? _width, _height
var tempData=new BitmapData (original._width,original._height,true,0xFFFFFF);
2309 posts
  • Beta Tester
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 100 and 1 000 dollars
  • United States
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
  • Antarctica
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Sold between 100 and 1 000 dollars
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
  • Beta Tester
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 100 and 1 000 dollars
  • United States
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
  • Antarctica
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Sold between 100 and 1 000 dollars
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
  • Beta Tester
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 100 and 1 000 dollars
  • United States
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. :)

5311 posts The Dude Abides
  • United States
  • Exclusive Author
  • Has been a member for 5-6 years
  • Elite Author
  • Bought between 100 and 499 items
  • Referred between 100 and 199 users
  • Author had a Free File of the Month
+5 more
CodingJack says
1389 posts
  • Beta Tester
  • Bought between 10 and 49 items
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Grew a moustache for the Envato Movember competition
  • Has been a member for 6-7 years
  • Referred between 10 and 49 users
+3 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
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Netherlands
  • Referred between 10 and 49 users
  • Sold between 5 000 and 10 000 dollars
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

by
by
by
by
by
by