I think you need to draw the loaded bitmap data in a new BitmapData
instance. Something like this:

var bitmap:Bitmap = _loader.content;
var bitmapData:BitmapData = new BitmapData( bitmap.width, bitmap.height,
true, 0x00000000 );
var sprite:Sprite = new Sprite();
bitmapData.draw( bitmap.bitmapData );
sprite.addChild( new Bitmap( bitmapData ) );

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Anthony Pace
Sent: Tuesday, November 25, 2008 10:42 AM
To: Cor; Flash Coders List
Subject: Re: [Flashcoders] as3 image loading and reusing amongst classes.
And listening to events fired by children.

I can trace out, and attach the child to the subclass and have it 
display the unformatted bmp,
so not only does my function work when passing the data, I have a 
starting point to test from.

What I am now wondering, is if it acts as a pointer to the original 
target, or of it duplicates the image...

public function newThumbNail(target:Bitmap, pos:uint) {
          //I am duplicating the data in case it is a pointer and not a 
newly instantiated object.
            var bmp:Bitmap = new Bitmap();
            bmp.bitmapData = target.bitmapData;

         //addChild(bmp);  I was able to see the data when passed using 
this.
         //the params for my new thumb constructor are just temporary... 
and they can be traced out from the subclass

            var tmb:thumb = new thumb(this.x, this.x, tmw, tmh);
            tmb.name = "thumb" + pos;
            tmb.newImage(bmp);
            this.thumbsContainer.addChildAt(tmb,pos);
        }
now when I want it to display the BMP in the thumb class... nothing 
happens...


Cor wrote:
> Try to trace where you loose the scope of your bitmap.
> Do you "return" it from your subclass??
>
> -----Original Message-----
> From: Anthony Pace [mailto:[EMAIL PROTECTED] 
> Sent: dinsdag 25 november 2008 16:01
> To: Cor; Flash Coders List
> Subject: Re: [Flashcoders] as3 image loading and reusing amongst classes.
> And listening to events fired by children.
>
> I have done that , put when I pass the function...
> newThumbNail(this.imageDataArray[this.imageDataArray.length-1]);
>
> it still does not display my image as a thumbnail...  I have tested to 
> see if it is receiving the image data, and it is; however, for some 
> reason, I can't seem to put it on the display list.  I have added all 
> children in order, and I am wondering what is going on.
>
> private function onImageLoad(event:Event):void {
>             var bmp:Bitmap = event.target.loader.content as Bitmap;
>             this.imageDataArray[this.imageDataArray.length] = bmp;
>             if (this.imageTotal == 0) {
>                 trace('we are getting this far');
>                 
> this.BIPanel.newImage(this.imageDataArray[this.imageDataArray.length-1]);
>                 //this is the call to the first big image and it loads 
> very well
>             }
>             
>
this.tPanel.newThumbNail(this.imageDataArray[this.imageDataArray.length-1], 
> imageTotal);
>            //............now this seems to pass the data but the image 
> is not displayed in the child class of thumbs panel
>            //thumbnailPanel class     thumbnail class.....
>            //yet, I have added everything as a child of it's parent.
> }
>
>
> it still does not show up; yet, the subClass method traces out the 
> bitmap data that was sent.  What am I doing wrong?  I need an answer 
> bad.  I used to be able to do this so easily in as2.
>
>
>
>
> Cor wrote:
>   
>> Put your bitmaps in a globally declared Array and they will be available
>>     
> at
>   
>> all times.
>>
>> -----Original Message-----
>> From: Anthony Pace [mailto:[EMAIL PROTECTED] 
>> Sent: dinsdag 25 november 2008 11:12
>> To: Cor
>> Subject: Re: [Flashcoders] as3 image loading and reusing amongst classes.
>> And listening to events fired by children.
>>
>> Actually,
>>
>> I thought I figured it out, and then it stopped working.  I was just 
>> duplicating the bitmap; yet, it doesn't seem to work anymore???  Maybe I 
>> messed up something...
>>
>>
>> Cor wrote:
>>   
>>     
>>> Hi Anthony,
>>>
>>> Good for you!
>>> I live in The Netherlands (GMT+1) so I missed some hours in your
>>>       
> progress.
>   
>>> Would you be so kind to share your solution?
>>>
>>> Kind regards
>>> Cor
>>>
>>>
>>> -----Original Message-----
>>> From: Anthony Pace [mailto:[EMAIL PROTECTED] 
>>> Sent: dinsdag 25 november 2008 4:12
>>> To: Cor
>>> Subject: Re: [Flashcoders] as3 image loading and reusing amongst
classes.
>>> And listening to events fired by children.
>>>
>>> Figured it out, and thanks for the help.
>>>
>>> Cor wrote:
>>>   
>>>     
>>>       
>>>> Just thinking about reparenting issues at this point, and your way is 
>>>> great if you record a depth variable and pass it back to a parent 
>>>> function which passes it back to a parent function etc... ;yet, what if

>>>> my parent has changed and I don't have that function available to me 
>>>> anymore?  Is there some way of doing this
>>>>
>>>> One addition: If you put your function in a class file (.as) they will
>>>> always be available, no matter what is on your stage.
>>>> Set this as your Document file and you are good to go.
>>>>
>>>> Grz
>>>> Cor
>>>>
>>>>
>>>>   
>>>>     
>>>>       
>>>>         
>>> No virus found in this incoming message.
>>> Checked by AVG - http://www.avg.com 
>>> Version: 8.0.175 / Virus Database: 270.9.10/1810 - Release Date:
>>>     
>>>       
>> 24-11-2008
>>   
>>     
>>> 14:36
>>>
>>>
>>>   
>>>     
>>>       
>> No virus found in this incoming message.
>> Checked by AVG - http://www.avg.com 
>> Version: 8.0.175 / Virus Database: 270.9.10/1810 - Release Date:
>>     
> 24-11-2008
>   
>> 14:36
>>
>>
>>   
>>     
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.175 / Virus Database: 270.9.10/1810 - Release Date:
24-11-2008
> 14:36
>
>
>   

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



DISCLAIMER:
E-mail Confidentiality/Proprietary Notice: The information contained in this 
transmission may be proprietary and subject to protection under the law. The 
message is intended for the sole use of the individual or entity to whom it is 
addressed. If you are not the intended recipient, you are notified that any 
use, distribution or copying of the message is strictly prohibited. If you 
received this transmission in error, please contact the sender immediately by 
replying to this e-mail and delete the material from any computer. Thank you.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to