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

When I use this code:

maininterface001.sidebar_dragbar.pattern=new Sprite ();
    maininterface001.sidebar_dragbar.addChild (maininterface001.sidebar_dragbar.pattern);
    maininterface001.sidebar_dragbar.pattern.graphics.beginFill (0xFF9900);
    maininterface001.sidebar_dragbar.pattern.graphics.drawRect (0,0,1,1);
    maininterface001.sidebar_dragbar.pattern.graphics.drawRect (1,1,1,1);
    maininterface001.sidebar_dragbar.pattern.graphics.endFill ();
    maininterface001.sidebar_dragbar.pattern.cacheAsBitmap=true;
    maininterface001.sidebar_dragbar.b_pattern=new BitmapData (maininterface001.sidebar_dragbar.pattern.width,maininterface001.sidebar_dragbar.pattern.height,true);
    maininterface001.sidebar_dragbar.b_pattern.draw (maininterface001.sidebar_dragbar.pattern);

I get this error:

TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Sprite@539aba1 to flash.display.BitmapData.

What am I doing wrong?

4 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
Potku says

I’m guessing that

maininterface001.sidebar_dragbar.b_pattern

is instantiated as a Sprite (and therefore can’t be typed as a BitmapData object).

If you attach the code where

maininterface001.sidebar_dragbar.b_pattern

is created, I can be more sure. Maybe this is part of something in the library? Are you actually creating b_pattern in that line?

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