[Flashcoders] AS 3.0 - Typecast a new Obj instantiated from a library linked class to a 'displayObject'

2007-02-23 Thread Dave Geurts
Hello,

  So I have a movieClip in the library that is set to Export as a class 
with the Auto Create Class feature, with the name rotate_sphere.  
rotate_sphere basically contains a .png  that I would like to copy as 
bitmapData to a new bitmap Object so that I can take advantage of the smoothing 
parameter on 'New Bitmap(bitmapData,snapping,SMOOTHING)'.  Because this object 
needs to scale and I would like to keep it looking smooth with keeping the 
edges anti aliased.  I am getting a Type Coercion error which reads:
 cannot convert rotate_sphere$ to flash.display.DisplayObject when I am trying 
to get the bitmapData.

  I figured that any class instantiated from the library at least extends type 
DisplayObject since whenever I instantiate a class from the library I can add 
it as a child, which requires the obj at least extend DisplayObject.  Im not 
sure if Im even going about this right way. Any thoughts or comments would be 
awesome! and thanks for your time to at least read through this!

 -Dave Geurts
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] AS 3.0 - Typecast a new Obj instantiated from a library linked class to a 'displayObject'

2007-02-23 Thread Rob Romanek

Hi Dave,

I'm not sure you need to be accessing your bitmap via a movieClip. I'm  
doing something similar but I use the bitmap directly from the library. I  
se the bitmap up an auto generated class using 'Linkage' i.e. 'myBitmap'  
then if I need the bitmapData in yourscript simply say:


var myBitmapData:myBitmap = new myBitmap();
var myBitmapInstance:Bitmap = new Bitmap(myBitmapData, auto, true);
this.addChild(myBitmapInstance);

No need for a movieClip. I'm going to guess that when you use the  
movieClip you are accessing the bitmap as a child of that movieClip and  
trying to extract the bitmapData from that. I tried a similar approach and  
it did not work. Seems that bitmaps assigned in authoring mode return a  
type of Shape and not Bitmap when you try to access them. I'm guessing  
this is a bug in the alpha version.


hth,

Rob

On Fri, 23 Feb 2007 13:12:55 -0500, Dave Geurts  
[EMAIL PROTECTED] wrote:



Hello,

  So I have a movieClip in the library that is set to Export as a  
class with the Auto Create Class feature, with the name  
rotate_sphere.  rotate_sphere basically contains a .png  that I would  
like to copy as bitmapData to a new bitmap Object so that I can take  
advantage of the smoothing parameter on 'New  
Bitmap(bitmapData,snapping,SMOOTHING)'.  Because this object needs to  
scale and I would like to keep it looking smooth with keeping the  
edges anti aliased.  I am getting a Type Coercion error which reads:
 cannot convert rotate_sphere$ to flash.display.DisplayObject when I am  
trying to get the bitmapData.

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com