• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Bitmap object

New Here ,
Mar 23, 2009 Mar 23, 2009

Copy link to clipboard

Copied

Hi. I am trying to load images dynamically to my stage. I am reading an xml file and trying to add the images to the scene. For some reason the image file seems to be loaded (I have put a trace "Success to check it") but when I try to addChild nothing happens.

This is the code of my class followed by the code of my flash file:

Does anybody have any ideas of why this is not working properly ? The main idea here is to load as many thumbnails as the xml file contains so I can play with them making a horizontal scroll.

Thanks for your help !

Thank you !!!

TOPICS
ActionScript

Views

867

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 26, 2009 Mar 26, 2009

Copy link to clipboard

Copied

Nobody ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 26, 2009 Mar 26, 2009

Copy link to clipboard

Copied

Are you loading the image from your domain or another domain?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 26, 2009 Mar 26, 2009

Copy link to clipboard

Copied

You can add a loader to the display list. There is no reason (from the code I see here) that you have to make a bmp of it.

And as _xchanin is hinting, you won't be able to draw() a bitmap from images loaded from other domains.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 26, 2009 Mar 26, 2009

Copy link to clipboard

Copied

I don't see where you're adding the ImageClip instance to the display list. Try this:

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 26, 2009 Mar 26, 2009

Copy link to clipboard

Copied

All images are on my website. I thought that just by adding a child that would be added to the display But ok, i will try it later and I'll let you know what happened.
Thank you all !!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2009 Mar 26, 2009

Copy link to clipboard

Copied

Your imageclip class is extending sprite so as Raymond suggests it needs to be added to the display list

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 27, 2009 Mar 27, 2009

Copy link to clipboard

Copied

ok, but what is this addchild on this function doing exactly ?

function onComplete( event:Event ) : void
{
// trace( "Successfully loaded." );

var bitmapData:BitmapData;
bitmapData = new BitmapData( loader.width, loader.height );
bitmapData.draw( loader );

image = new Bitmap;
image.bitmapData = bitmapData;
image.smoothing = true;

addChild( image );
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 27, 2009 Mar 27, 2009

Copy link to clipboard

Copied

adds the image to the display list

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 27, 2009 Mar 27, 2009

Copy link to clipboard

Copied

That is adding the Bitmap instance to the ImageClip's display list. But something needs to add the ImageClip instance to the main displaylist. That is why you need it in two places!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 28, 2009 Mar 28, 2009

Copy link to clipboard

Copied

Think of your class (which is an extension of Sprite) as a container with display objects inside. The container needs to be added for it and its contents to be displayed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 28, 2009 Mar 28, 2009

Copy link to clipboard

Copied

Yes...it worked !!!!!!
Thanks you all guys.....it really makes sense to me now !

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 28, 2009 Mar 28, 2009

Copy link to clipboard

Copied

LATEST
And like I said before you don't have to make a bitmap, unless you plan to do other bitmappy things to the image. You can just add the Loader instance to the display list.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines