1 person found this helpful
Content you load dynamically does not have a home on the timeline unless you designate it to be loaded into one. Such a home would be a movieclip that you manually add to the timeline. So if you made such a home, named it mc, then you could use...
and load whatever into that. It should not remain after you leave the frame that mc is in. Once you have loaded the video, it should be readily available via the user's cache. But if you want to retain it to avoid the chance that it was removed from the cache between frame changes (not likely), then your only option is to make things invisible (set the _visible property of the created movieclip to false)... though you may need to manage the video as well to shut it down and whatnot.
Thank you so much for your response, which was extremely clear as ever, that makes perfect sense and i understand the logic now so thank you! One follow up question, i have created an empty mc manually on the stage as you suggested and have created my mc via as2 within it. This works fine and now it only shows up when within the about us section. I am using the YouTube AS2 API to embed a youtube video within this movieclip, the start of this code (to create the mc) is:
var ytplayer:MovieClip = createEmptyMovieClip("ytplayer", 1);
As a result I have just changed it to the following (where video_mc is the instance name of the movieclip i manually put on the stage):
var ytplayer:MovieClip = video_mc.createEmptyMovieClip("ytplayer", 1);
This is great and works fine however prior to this I need to check for the existence of the movieclip so I could see whether to recreate it or not. I was using:
to check for it's existence which worked fine, however with the new code I thought the following code should be used but it does not seem to work:
Similarly, I suspect it's the same problem with the following code (i'm using it when navigating to another section to stop it from playing as the audio continues to play even though the player disappears):
ytplayer.pauseVideo(); // This works fine when using the original code video_mc.ytplayer.pauseVideo(); // This doesnt work
I think these are probably both the same issue and that I should be referencing it in a different way (and not video_mc.ytplayer), but I can't work out what and nothing i try seems to work. If you could shed any light on these remaining issues in then that would be massively appreciated as i'm rather confused!
Thank you so much for your help as ever,
For some reason I could not get the bits to work that i described in the previous thread so I ended up creating it via AS2 and then making it's _visible property false whenever you visit any other page which prevents it from displaying. This works fine but I would be most grateful if anyone could explain why what I was trying to do didn't work so I can better understand it all for the future.
Thanks so much for your help,