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?
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?
