dcsimg
A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: If (X.swf is loaded)

  1. #1

    If (X.swf is loaded)

    Is there a way of saying

    If some.swf is loaded
    do these things...
    else
    do these things...

    Thanks

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    What does a preloader do?

    If the movie is loaded, play it, if not continue preloading it!

  3. #3
    i should of explained more...

    i have the index.swf that loads the menu.swf and on the menu it has a button that when clicked loads app.swf then when i click that button on the menu again i dont want it to do the same things it did when it first loaded app.swf i want it to do a 2nd command.

    This is my current command:

    on (press) {
    with (exp) {
    gotoAndPlay("down");
    }
    with (_level4) {
    gotoAndPlay("away");
    }
    loadMovieNum("exp.swf", 3);
    }
    on (rollOver) {
    x = "OUR EXPERIENCE";
    }
    {


    I want to change it so i can have a second command if it has already loaded the page.

    but

    if it unloads this page i need it to do this first command again...

    do you follow?

    thanks again

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    You could set a variable the first time that button is pressed, and condition the button's actionscript to that variable being true or not. In other words...
    Using a variable such as: _level0.first_done (default is false)!
    code:

    on(release){
    if(_level0.first_done == false){
    // Your first actions as posted above...
    // + the following line, setting the variable to true...
    _level0.first_done = true;
    } else {
    // Your next series of actions...
    }
    }


    Get it?

  5. #5
    I did this and it doesnt load the swf, but is i move "loadmove" up out of the "if" statement it works but thats the bit i really need in the if statement. Any Solution?

    on (rollOver) {
    x = "OUR EXPERIENCE";
    }
    on (release) {
    if (_level0.first_done == false) {
    loadMovieNum("exp.swf", 3);
    with (exp) {
    gotoAndPlay("down");
    }
    with (_level4) {
    gotoAndPlay("away");
    }
    _level0.first_done = true;
    } else {
    with (exp) {
    gotoAndPlay("down");
    }
    }
    }



    PS. What does the "first_done" mean or do?

  6. #6
    PHP Code:
    on (rollOver) {
        
    "OUR EXPERIENCE";
    }
    on (release) {
        if (
    _level0.first_done == false) {
            
    loadMovie("exp.swf"3);
            
    with (exp) {
                
    gotoAndPlay("down");
            }
            
    with (_level4) {
                
    gotoAndPlay("away");
            }
            
    _level0.first_done true;
        } else {
            
    with (exp) {
                
    gotoAndPlay("down");
            }
        }


  7. #7
    Code:
    on (rollOver) {
    	x = "OUR EXPERIENCE";
    }
    on (release) {
    	if (_level0.first_done == false) {
    		loadMovie("exp.swf", 3);
    		with (exp) {
    			gotoAndPlay("down");
    		}
    		with (_level4) {
    			gotoAndPlay("away");
    		}
    		_level0.first_done = true;
    	} else {
    		with (exp) {
    			gotoAndPlay("down");
    		}
    	}
    }
    Sorry I am just trying to work out how to do this so you can see clearly what i am doing.

    Thanks

  8. #8
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Can you attach your .fla(s)? Zip them up!
    Or e-mail them to me? PM me your address and I'll provide my e-mail.

  9. #9
    hey are you here today?

    Sorry im in Aust. May be a bit of a time delay.

    I sent you my email address if you wanted to look at my FLA's you can email me your email address.

    If anyone else is reading this can can throw some wisdom this way too!

  10. #10
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Check your PMs.

  11. #11
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Will look at your file now!

  12. #12
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    OK! I've commented out your with actions, because they weren't working in the files you sent me. Don't really understand what you're trying to do with those anyways!

    This script works if you set the variable _level0.first_done = false; on the first frame of your movie, along with your line x = "WELCOME";
    By the way, that variable could of been named whatever else, I just wanted to indicate, that some first actions had already been processed, because that button was pressed once already.

    code:

    on (press) {
    if (_level0.first_done == false){
    trace("This is the first time this button was pressed!");
    /* with (web) {
    gotoAndPlay("down");
    }
    with (_level4) {
    gotoAndPlay("away");
    }*/
    loadMovieNum("web.swf", 3);
    _level0.first_done = true;
    } else {
    // Do some other actions...
    // Or simply stop if this is the second press...
    trace("This button was already pressed once!");
    stop();
    }
    }
    on (rollOver) {
    x = "WEB DESIGN";
    }


Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center