SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Trying to make a logo play once per session

    Hey, I got a swf logo at www.level.is that I want to play once per session. Preferably I want it to play once every time someone opens or closes the tab/browser but not while the user navigates the site..

    I'm using:

    mySharedObject = SharedObject.getLocal("savedObject");
    _root.onLoad = function() {
    if (mySharedObject.data.visited) {
    _root.gotoAndStop(92);
    } else {
    mySharedObject.data.visited = true;
    mySharedObject.flush();
    result = mySharedObject.flush();
    if (result) {
    //all good
    } else if (!result) {
    //user at never -- prompt user
    System.showSettings(1);
    }
    _root.play();
    }
    }

    At the moment but it seems to randomly jump between frames even tho I have it set to the last frame of my animation..Also it doesn't play when I close my browser and open it again.. It seems never to play for me even if I clear my cookies...

    Does anyone have a better code for me? I'm a complete newbie in AS and flash but I get by with HOURS of googling and asking.. Thanks!

  2. #2
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,547
    Mentioned
    40 Post(s)
    Tagged
    1 Thread(s)
    I'd test the logical switches in your function by tracing responses to a textfield so you can monitor in-browser response.

  3. #3
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks... Could you be any more specific.. I'm a complete newbie in actionscript

  4. #4
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,547
    Mentioned
    40 Post(s)
    Tagged
    1 Thread(s)
    put a dynamic textfield on stage at the top level, visible over all frames. You can then write text to this to monitor what's happening. Normally you would just use trace, but because you need to debug in the browser, this isn't readily available (you could use remote debugging though)

    So wherever you have an if/else switch in your code, or need to see if a frame or action has been activated, after each possibility you could use something like

    _root.mytextfieldname.text = "mySharedObject.data.visited was true";


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •