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?

by
by
by
by
by
by