PDA

View Full Version : Error after many hotspot


Ale_88
10-09-2009, 01:36 PM
Hi everybody, i'm an italian developer and i'm sorry for my bad english..
I have a very big problem with flashpanorama in flash..
I have make an application that call many panorama. if you click in a button load a panorama, if you click an another button unload the swf and load another swf with a new panorama.. but my problem is that panorama contain many hotspot and in my memory increase.
i have write
panorama.pano.remove
panorama=null..
but nothign the ram memory increase every time you see a panorama.
If i navigate many panorama i have this error and i don't see anything

ArgumentError: Error #2015: BitmapData not valid..
at flash.display::BitmapData/get width()
at CubePanorama/::loadContent()
at CubePanorama/::loadComplete()
ArgumentError: Error #2015: BitmapData not valid..
at flash.display::BitmapData/get width()
at CubePanorama/::loadContent()
at CubePanorama/::loadComplete()
ArgumentError: Error #2015: BitmapData not valid..
at flash.display::BitmapData/get width()
at CubePanorama/::loadContent()
at CubePanorama/::loadComplete()
ArgumentError: Error #2015: BitmapData not valid..
at flash.display::BitmapData/get width()
at CubePanorama/::loadContent()
at CubePanorama/::loadComplete()
ArgumentError: Error #2015: BitmapData not valid..
at flash.display::BitmapData/get width()
at CubePanorama/::loadContent()
at CubePanorama/::loadComplete()
ArgumentError: Error #2015: BitmapData not valid.
at flash.display::BitmapData/get width()
at CubePanorama/::loadContent()
at CubePanorama/::loadComplete()


how can i release the memory of every panorama?Help me please is very important... :confused::confused:

Trausti Hraunfjord
10-09-2009, 04:24 PM
Key words are:

Weak references and garbage collection.

Ale_88
10-09-2009, 04:39 PM
Thanks but how can i resolve it please?

Ale_88
10-09-2009, 05:36 PM
This is my code when i load a panorama



var panorama:MovieClip

var stream:URLStream = new URLStream();

var url:URLRequest = new URLRequest(percorso+nome_vr+".swf");
stream.addEventListener(Event.COMPLETE, onImageData);
stream.load(url);
var imageData:ByteArray = new ByteArray();

var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, onCompleted);

addChild(loader);

function onImageData(e:Event):void{
stream.readBytes( imageData , imageData.length );
stream.close();
loader.loadBytes( imageData );
}

function onCompleted(e:Event):void{

panorama = e.target.content as MovieClip;
panorama.setArea(0,0,938,702);
trace(nome_vr);
panorama.loadPanorama("panoName="+percorso+nome_vr +"&xml_file="+percorso+nome_vr+".xml"); //load with predefined XML data

addChild(panorama);
//pos=arr.length();
panorama.scaleX=1;
panorama.scaleY=1;
panorama.alpha=0;
panorama.x=2000;
panorama.y=2115;
TweenLite.to(panorama,5, {alpha:0,scaleX:1,scaleY:1,onComplete:vedi_vr});
}

function esci_def()
{
panorama.pano.remove();
imageData=null;
//loader.unload();
// loader.unloadAndStop()
removeChild(loader);
removeChild(panorama);
//removeChild(stream);
//stream.close();
panorama.pano=null;
panorama=null;
loader=null;
stream=null;

(root.loaderInfo.loader.root as Object).load_mc("grafica_1.swf");
}


in function esci_def i want to unload everything but in memeory (if i see in the task manager) doesn't go down

Trausti Hraunfjord
10-09-2009, 05:37 PM
Posting a link to your project online would of course be helpful. If you can zip up your project, I am sure some good people would be more than able to help you out.

I only work with FFC, and don't build tours into Flash containers, so I don't have problems of your kind...

... and I am a complete idiot on the coding/programming front... only know that the issue you have is related to lack of garbage collection.

Ale_88
10-09-2009, 05:39 PM
my project is 2,55 gb..:) there are many panorama, it's a desktop application.. i have posted the code a post ago..

Trausti Hraunfjord
10-09-2009, 06:03 PM
2.55 gb... ouch... that IS big. I hope there will be someone who can help you get over this problem.

Ale_88
10-10-2009, 08:42 AM
There vr very very big and beautiful but i need to free the memory...
i hope that someone can help me.. :confused::(

Trausti Hraunfjord
10-10-2009, 07:28 PM
Taking a few minutes of my programmers time... he came up with this suggestion:

Replace this:

function esci_def()
{
panorama.pano.remove();
imageData=null;
//loader.unload();
// loader.unloadAndStop()
removeChild(loader);
removeChild(panorama);
//removeChild(stream);
//stream.close();
panorama.pano=null;
panorama=null;
loader=null;
stream=null;

(root.loaderInfo.loader.root as Object).load_mc("grafica_1.swf");
}

... with this:


function esci_def()
{
panorama.pano.remove();
panorama.pano=null;
removeChild(panorama);
panorama=null;
imageData.clear();
imageData=null;
removeChild(loader);
loader.unloadAndStop();
loader=null;
stream=null;

(root.loaderInfo.loader.root as Object).load_mc("grafica_1.swf");

... and he thinks your problem should be fixed.