Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

Closed Thread
Results 1 to 4 of 4
  1. #1

    Default Very easy If statement

    Hi all... I did something stupid and saved over a file that was already working.

    What I have is a an external "Home" movie and what it does is on the main movie I have a target that says "begining" then after that target it does something then goes to an "opendoor" target.

    In the "home" movie I had an if statement that did something like

    If this is the first time this movie is loaded
    gotoandplay begining
    else
    gotoandplay opendoors


    anyone know how i can accomplish this? I really had it before and was working great, then I made a mistake and can't think how I got it before.

    Thank you Eric

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2
    Join Date
    May 2004
    Location
    U.S.A.
    Posts
    2,890

    Default

    Hi,

    Assuming your referring to using a shared object to remember if a visitor has visited the site before...

    Code:
    stop();
    mySharedObject = SharedObject.getLocal("savedObject");
    _root.onLoad = function() {
    	if (mySharedObject.data.visited) {
    		_root.gotoAndStop("visited");
    	} 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();
    	}
    }
    A mind once stretched by a new idea never regains its original dimensions.
    - Oliver Wendell Holmes

  4. #3

    Default

    I'm actually trying to do this.

    Code:
    if (_root.onLoad)
    {	
    	_root.play("begining");
    }
    else
    {
    	_root.gotoAndPlay("opendoors");
    	gotoAndPlay(5);
    }
    I have this code on my external SWF file.. then what I want is if this movie has loaded for the first time... play begining.. else (meaning if it has been loaded before play opendoors.

    does that make any sense?

  5. #4

    Default

    I got it... thank you for trying.. here is the code that works for me.

    if (_root.section != "home")
    {
    _root.play("begining");
    }
    else if (_root.section == "home")
    {
    _root.gotoAndPlay("opendoors");
    gotoAndPlay(5);
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Button with if/else statement. Help please! (Flash MX)
    By aussie01 in forum Flash Scripting
    Replies: 11
    Last Post: 12-22-2004, 03:16 PM
  2. Replies: 3
    Last Post: 12-02-2004, 10:02 PM
  3. need help w/ Easy actionscript 2 MX2004
    By TG_Laszlo in forum Flash Scripting
    Replies: 2
    Last Post: 04-27-2004, 09:09 AM
  4. *VERY EASY QUESTION*
    By Unforgiven in forum General Flash
    Replies: 5
    Last Post: 11-22-2003, 12:03 AM

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
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial