Thursday, June 28, 2012

[Action Script] Dynamic image loaded into a Masked layer June,2012

I am trying to load images into a masked layer but the image just appears unmasked. Here is the code I am using to load the image. As you can see it is pretty standard stuff. You will note, though, that I am adding the child at the level of the masked layer.

ActionScript Code: public function loadImage(url:String):void {            imageLoader = new Loader();            imageLoader.load(new URLRequest("_art/" + url));            imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading);            imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);                    }        public function imageLoaded(e:Event):void {            _parent.parent.mcOcular.addChildAt(imageLoader, 0);loadImage("butterfly.png")
I am creating a training tool to teach students how to use a light microscope. There will be anywhere from 10 to 30 slides that they can choose from and place on the tray. I load the image in the round viewport once they place the slide. The image loads properly, but it is not adhering to the round viewport mask. The whole image is seen on stage.

What might I be doing wrong? Has anyone else had this issue and, if so, what can I do to fix it. This is all in AS3, of course.

Thanks in Advance guys!
Dynamic image loaded into a Masked layer

Related Post



0 comments: