Archive for April, 2011

Yeah again i faced a little strange problem that i solved it. In my one of previous post i wrote about using movieclip with plane primitives of papervision and also accessing that movie. Now comes the main discussion of this post that is accessing movieclip from papervision plane.

Lets say i have attached a mouse listener to plane to which moviematerial is mapped. So when i click plane i want to do/manipulate the movieclip that is mapped to plane via moviematerial so code would look something like this:

private function planePressed(event:InteractiveScene3DEvent):void{
var moviemc=event.target.material.movie as Movieclip;
// do manipulation or changes on moviemc

the above snippet works, i mean u can access the movieclip on above do the later changes to it if u want.

But lets say there is no listener attached to the plane but later in program cycle i want to modify the movieclip attached to plane like applying blurr filter to it. Then i would do something like this:

var mc=my_papervision_plane.material.movie as Movieclip;
//apply blurr filter to mc

Well the above code didn’t work for me. In previous above event handler i traced event.target and it traced plane object, so it seems like ‘.material’ returned MaterialObject3D so i have to first downcast it to MovieMaterial separately and then try to access movie property on it. Here is the error:

So here is how is the stupid solution 😀

var mat=my_papervision_plane.material as MovieMaterial;
if(mat){//just being safe
var mc=mat.movie as Movieclip;

So that worked. But still i didn’t had to do that inside my event handler when i was accessing via even.target, maybe i am missing something out. Right now i am going through docs of papervision.


Hello  Flashers ,

Have you ever come across the dreaded “<error>” ?  If you have read on, if you haven’t you might wanna take a look at this.

Well  it started out like this………i was working on dynamic flash slideshow gallery. I was loading external images and paths were saved on xml file. Slideshow was working and running smoothly until i closed my browser window and received “Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.”.  Grrrrrrrrrrrrrr. When i closed my browser window i got this exception error on a window, here is the screenshot:

This error only comes when image was being loaded(preloader is shown during loading) and during that loading period if i close my browser exception error was being thrown. I knew the reason behind the error but didn’t knew the solution to handle it.

I didn’t knew what to. What was i supposed to do when error was coming on closing the browser ? I thought it was a browser issue. But there are lots of this kind of application out there and they doesn’t have this issue. So i have to do something about this “memory leak” thingy. So i found the solution for this and solution is to add the error handler to loader:

image_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);

private function ioErrorHandler(event:IOErrorEvent):void
//do your stuff

I hope it helped to those who faced same problem like me.