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

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
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Sold between 1 000 and 5 000 dollars
  • United States
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