Image is empty

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Image is empty

DMBur
This post has NOT been accepted by the mailing list yet.
This post was updated on .
so following thing i know the image loads in the movie clip
but does not go to the MovieMaterial.
its empty
and i can't figure out what i did wrong... any advise be welcome

                                var qr = "http://somewhere.com/image.jpg";

                                var mc:MovieClip = new MovieClip();
                                var qi = new Loader();
                                qi.load(new URLRequest(qr));
                                mc.addChild(qi)


                                //make new material
                                var mat:MovieMaterial = new MovieMaterial(mc);
                                mat.doubleSided = true;
                                mat.smooth = true;
                                mat.tiled = true;
                                var p:Plane = new Plane(mat, 100, 80, 2, 2);
                                scene.addChild(p);
Reply | Threaded
Open this post in threaded view
|

Re: Image is empty

Mahesh
This post has NOT been accepted by the mailing list yet.
You supposed to add loaded content but not immediately.

var img:String = "http://blabla...";
var req:URLRequest = new URLRequest(img);
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoadHandler);
ldr.load(req);

public function imageLoadHandler(evt:Evnt):void{
var ldr1:Loader = Loader(evt.target.loader);
var bitmap1:Bitmap;
bitmap1 = Bitmap(ldr1.content);

}

Then do the next what do want to.