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

Bitmap object

New Here ,
Mar 23, 2009 Mar 23, 2009
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
1.0K
Translate
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
Nobody ?
Translate
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
Are you loading the image from your domain or another domain?
Translate
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
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.
Translate
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
I don't see where you're adding the ImageClip instance to the display list. Try this:
Translate
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
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 !!
Translate
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
Your imageclip class is extending sprite so as Raymond suggests it needs to be added to the display list
Translate
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
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 );
}
Translate
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
adds the image to the display list
Translate
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
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!
Translate
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
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.
Translate
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
Yes...it worked !!!!!!
Thanks you all guys.....it really makes sense to me now !
Translate
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
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.
Translate
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