Preventing flash banner from reloading on sub pages --HELP!--

Hello - I am using a simple flash banner at the top of ALL of a web sites pages but I don't want the banner to reload when the user navigates to a sub page.
I would like it to pick up at the last frame the animation was in on the previous page.
I have seen references to the SharedObject function in Flash but I'm not an actionscript programmer (low level action script experience) and nothing seems to work.
Help with this would be GREATLY appreciated!
ballrAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sajayj2009Commented:
Using swfObject and sharing a value to subpages will solve your problem.
sajayj2009Commented:
or else;

make your page to .php

at beginning of page in sourcecode;

<?php
$Value=$_REQUEST["Value"];
?>



inside embed swf;



<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1000" height="670">
  <param name="movie" value="moviename.swf?Value=<?=$Value; ?>" />
  <param name="quality" value="high" />
  <param name="allowScriptAccess" value="sameDomain" />
  <param name="wmode" value="transparent" />
  <param name="swfversion" value="9.0.45.0" />
  <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you dont want users to see the prompt. -->
  <param name="expressinstall" value="http://www.leafgrafica.com/projects/inaya/Scripts/expressInstall.swf" />
  <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
  <!--[if !IE]>-->
  <object type="application/x-shockwave-flash" data="moviename.swf?Value=<?=$Value; ?>" width="1000" height="670">
    <!--<![endif]-->
    <param name="quality" value="high" />
    <param name="wmode" value="transparent" />
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="swfversion" value="9.0.45.0" />
    <param name="expressinstall" value="http://www.leafgrafica.com/projects/inaya/Scripts/expressInstall.swf" />
    <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
    <div>
      <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
      <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="670" /></a></p>
    </div>
    <!--[if !IE]>-->
  </object>
  <!--<![endif]-->
</object>




inside flash;


first frame code -

n=_root.Value;

if(n==1) {
gotoAndPlay("lastFrame");
}
IqAndreasCommented:
Here is more information on SharedObjects, also known as "Flash Cookies"
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/SharedObject.html

And in case the language reference is a little too dry for you, there was also a chapter on Shared Objects in Adobe's free online book "Programming ActionScript 3.0"
http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d80.html
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

limweizhongCommented:
You can use the cookies and flash methods in JavaScript to solve the problem. I have not tested yet, but perhaps it would give you the idea.
onload=function(){ document.getElementById('flashobj').gotoFrame(('&'+document.cookie).split(/&currframe=/)[1].split(/&/)[0]); }
onunload=function(){ document.cookie='currframe'+document.getElementById('flashobj').TCurrentFrame('/'); }

Open in new window

limweizhongCommented:
sorry it should be document.cookie='currframe='... (I can't remember whether a time/date is needed though)
MonstahCommented:
If you're not interested in SEO or other user's responses are to difficult for you, putting the swf inside and iframe (that's a html tag) will solve the problem.
ballrAuthor Commented:
IqAndreas - I have read most of the pages you gave me and I'm just lost on it...does anyone know of existing code for this? I'm just not able to write code from scratch.
IqAndreasCommented:
So does the banner run as a full animation (meaning it changes the "currentFrame" property several times per second, or do you have it stop on frames, and want to record where the frame was stopped last?

Since it is not possible to attach two pieces of code to one document, I will split up the reply.

This first code is for constantly running animations, and will record the current frame EVERY SECOND, which means, if the animation is running at 30 frames per second, it may be off by as much as 30 frames, however, it will only be one second of animation, so the user won't even notice.

Saving the currentFrame each and every frame just isn't a good idea, and will bog down performance.

var so:SharedObject = SharedObject.getLocal("currentFrameSO"); 
if (so.size == 0) 
{ 
    //Create the shared object if it does not exist
    so.data.curFrame = this.currentFrame; 
    so.flush();
} 
else
{
    //If it does exist, load in which frame is supposed to be the current one
    this.gotoAndPlay(so.data.curFrame);
}


//This timer will tick every second, and the save the current frame
//to the shared object
var timer:Timer = new Timer(1000);
timer.addEventListener(TimerEvent.TIMER, saveFrame);
timer.start();

function saveFrame(e:TimerEvent):void
{
    so.data.curFrame = this.currentFrame; 
    so.flush();
}

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IqAndreasCommented:
This second piece of code is for if each frame is used as a new page, and when you display a frame, instead of just playing through it, you typically stop on frames and wait for user input.


When your banner first starts, the "getSavedFrame()" function will return whichever frame was saved from last time, which you can then set via "gotoAndStop()".
Whenever you move to a new frame, call the "saveCurrentFrame()" function.

That way you will always know which frame your animation is supposed to be on.


If you need any more help, or want me to explain the code better, please ask.

Good luck with your programming,
Andreas

var so:SharedObject = SharedObject.getLocal("currentFrameSO"); 

function getSavedFrame():int
{
   if (so.size == 0) 
   { 
       //Create the shared object if it does not exist
       so.data.curFrame = this.currentFrame; 
       so.flush();
   } 
   
   return so.data.curFrame;
}


function saveCurrentFrame():void
{
    so.data.curFrame = this.currentFrame; 
    so.flush();
}

Open in new window

ballrAuthor Commented:
IqAndreas - It is a full animation. Just a looping run of different images.

WOW - I really appreciate your help with this! I will give it a try and hope it works! This is great!!!!
ballrAuthor Commented:
IqAndreas  made it easy for me to just copy the code and make it work. Also offered multiple solutions! GREAT JOB!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.