PDA

View Full Version : Interactive CD-ROM - unload / remove pano's


martynrlee
03-06-2008, 04:13 PM
Hi Guys,

I am currently developing an interactive cd-rom in flash cs3 for a hotel (14 virtual tours) and have adapted the embedpano example.

I am able to load and unload panoramas if I remain within a single frame, however when I navigate away and come back I am not able to remove / unload the last pano.

I am relatively new to actionscript but I believe I am looking for perhaps one of two methods (psuedocode):

1) on exit the current frame - unload current pano
2) on enter the current frame - if a pano is loaded : remove / unload

I am open to all ideas / suggestions / solutions.... look forward to your advice.

neil
03-06-2008, 10:00 PM
If you are using Denis's embedPano as a template, the panoramas are being displayed in the variable "loader". As a simple solution, on the new frame try:

removeChild(loader);

Neil

martynrlee
03-07-2008, 09:24 AM
Hi Neil,

Thanks for your response. I have already tried that method and also by using the following method (as other people on the forum have mentioned to use) :

loader.unload();
removeChild(loader)
loader=null;

I can get this to unload the panorama if applying the code on the same frame however if if the playhead moves to another frame and I apply the code there it does not remove the original pano correctly.

The border of the pano remains on the new page and then if I go back to my original pano page the virtual tour glitches ( because it has not unloaded the orig pano).

Any ideas ? Really struggling with this... so all help most appreciated!!

martynrlee
03-11-2008, 07:48 AM
I have still not resolved this problem, just wondered if there is anyone that might have any further ideas on this subject?

neil
03-12-2008, 02:46 AM
Hi Martyn,

I'm not a scripting expert but when I had a similar problem - moving from a frame with a FPP virtual tour to a new frame that featured a stills slideshow, the removeChild(loader); command worked successfully. Without the script, the pano continued to display over the content in the new frame.

Is your border a separate graphic or movie clip from the pano? If so, you'll have to remove it as well. I put the border on frame 2 of the movie clip and a stop(); command in the first frame so the border wasn't visible.

When I used the other script you mentioned:

loader.unload();
removeChild(loader)
loader=null;

I got an error message "Error #2007: Parameter child must be non-null." Using the single command worked fine.

If you post an example, one of the AS3 experts may be able to provide a better solution.

zleifr
03-12-2008, 03:44 AM
martynrlee: I have tried to do basically what you are doing, and have not had much success. Are you using autorotator? That is the particular plugin that I could not get to remove. I think that I might, maybe have been able to get it to work, had it not been for autorotator. The problem, with plugins especially is that each one has to implement its own removal code, which is not exactly a simple thing in AS3, (flaw of AS3 in my opinion), and on top of that, getting functionality is usually the plugin writer's goal, and the rare person who wants to remove that functionality is not usually on top of the list of priorities or things to test for bugs, or memory leaks, etc either, and to top it all off, it is not easy to test for bugs / memory leaks in the garbage collection process.

So you put it all together, and you end up with a royal headache.

I would maybe recommend the advice to try using removeChild on the panorama object, which won't remove if from memory, and might slow the application, but it will remove it from the display list, and you shouldn't have any troubles putting it back in the display list. If you really need to free up the memory / cpu, Denis' removal code has usually seemed good enough, so you might get it to work, but be very careful about which plugins you use.

Hope that helps,
Zephyr

martynrlee
03-12-2008, 08:27 AM
Neil, zleifr,

Thank you very much for your responses... this seems like a difficult topic to approach.

I am not actually trying to use any plugins at the moment, I am quite happy to just get this up and running without the auto-rotator or the borders/ limits etc.

I will try your border / frame technique Neil, that could resolve the issue and will keep in mind everything you have mentioned Zleifr. I will also upload an example to have a look at to see if I can get to the bottom of this...

thanks again...

martynrlee
03-12-2008, 10:35 AM
ok, I have been playing around this morning based on the feedback:

I have got this working (removing/unloading the panorama) as long as I don't navigate out of the movieclip by using the following frame script:


if (panorama == null)

{
trace("no panorama loaded");
}
else
{
trace("panorama is already loaded" );
loader.unload();
panorama.pano.remove();
removeChild(loader);
removeChild(border);
loader=null;

}

It Works!!!

However... as soon as I navigate away to another movieclip, the variables are no longer recognised, so the panorama cannot then be unloaded and causes the glitch when the movie is loaded again.

So close now to a final soution.... any ideas?

zleifr
03-12-2008, 12:39 PM
Can you give some more of the code? specifically the code for where you are trying to load the movie again....

If you do that, and it clears out FPP properly, you should need to use the same code over again to re-load it. Unless it didn't clear out FPP properly and there's old FPP junk floating about conflicting with your shiny newly loaded FPP instance.

Zephyr

martynrlee
03-12-2008, 01:47 PM
Zleifr,

I have uploaded an example of the code I am using to the following address (downloadable zip):

http://www.lyonsphotography.co.uk/testing-folder/ (http://www.lyonsphotography.co.uk/testing-folder/)

Directions:

Click on the 'begin test' / start movie. - this will jump to the second frame on stage.

Click on the load panorama from inside movieclip - this will go to a new frame in the nested movieclip containing the panorama.

Click on the 'skip back to start of movieclip' - this will go back to start of movieclip and stop.

If you click on the 'load panorama from inside movieclip' now the panorama loads / works perfectly - so it has successfully unloaded and re-loaded the panorama from within the movieclip.

However if you click the 'navigate outside the movieclip' button after you have loaded the panorama and then go back to the panorama. The panorama will glitch - and it has not unloaded the panorama properly.

I need to be able to move between movieclips and to be able to unload and reload the panoramas without it glitching as it does when the playhead is contained within the current movieclip.

This is the problem I am having, hopefully this all helps to explain it. Really appreciate your help with this....