AS3, swfAddress and external swf's

  • Sigmundo
  • Born
  • Born
  • Sigmundo
  • Posts: 3

Post 3+ Months Ago

This might be a bit special, but I know of few other places to post it. I am trying to get to grips with the wonderful world of swfAddress and AS3. I'm loading an external swf into my main swf, and the external swf is a custom made videoplayer. I have set up the javascript files correctly and the swfAdress "onChange function" is working. I'm using switch-statements. Everything is working fine, I have a textfield going which renders the different values received from the different mouseclicks, so I can keep track on what's happeneing most of the time.

My problem is that if I've loaded the videoplayer and then unloaded it and click the "Back"-button in my browser (any browser), the case taking care of the value (for instance "/Video?side=Video0") sent to the onChange-function must load the videoplayer again. But this is the same case that will be used if I'm navigating between the different videos in the videoplayer. I could use an "if-"statement, but I don't know what to check for. So how can I tell the script that this time when you read "/Video?side=Video0" you have to load the videoplayer, but this time when you read it you shall not load the videoplayer (because it is allready present)?

I know someone must have encountered and solved this sometime somewhere, but I can't find any information on it.

It's a testsite for a childrens tv-programme in Norwegian, but you get the idea: http://nrksuper.no/superstore/flashfiles/sigtest/dyplenking/btv/. I can post the code too, or some of it, but all variables, functions and comments are in Norwegian. Anyway, I don't think my problem has so much to do with the code, other than it might be smarter/cooler/more best-practise ways to structure it. But I might need to find another way to write it if I want to accomplish this. Which I have to!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

Why you unload the videoplayer?
Can't you just hide it and close the net stream? (or stop the video player if you don't have access to it's net stream).
So the idea is that you declare a variable as false and then check it, if it's false, load your video player and set the variable to true. If true, then just make the videoPlayer visible.
As an example:
Code: [ Select ]
var videLoaded:Boolean = false;
... code .....
And where you load the video:
if (!videoLoaded)
{
LoadVideo();
videoLoaded = true;
}
else
videoPlayer.visible = true;
  1. var videLoaded:Boolean = false;
  2. ... code .....
  3. And where you load the video:
  4. if (!videoLoaded)
  5. {
  6. LoadVideo();
  7. videoLoaded = true;
  8. }
  9. else
  10. videoPlayer.visible = true;

Tell me if i'm writing stupid things :D
Didn't work with the swfAddress til now, but i think this will work regardless of swfAddress.
  • Sigmundo
  • Born
  • Born
  • Sigmundo
  • Posts: 3

Post 3+ Months Ago

Thank's. I have briefly considered this possibility. I'm still curious about how to do this if you load/unload movies though. Maybe it's not possible ...
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

it's just as possible. The idea is the same, only instead of hiding / showing the videoPlayer, you load or unload. When you load the videoplayer, set the variable videLoaded to true, and when you unload it, set it to false. And just as above, verify the variable before loading the video.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 23 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.