A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: loadMovie help

  1. #1
    better than chuck norris
    Join Date
    Jun 2004
    Location
    West Coast of Michigan
    Posts
    667

    loadMovie help

    I was planning on making a game that involved loading .swf into .swf and variables from .txt. The text part worked fine, but when I load a .swf, none of the actions work. I know the actions work because when I run the .swf I want to load, it works fine. But when I load it, no actions....
    Any help is appreciated. Thanks.

    Umm... I got rid of that stupid avatar my friend put there, but it isn't going away.
    Last edited by Santuria; 09-19-2006 at 08:33 AM.

  2. #2
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    Mate can you remove your footer please ? The footer rules are available to read on the board with a bit of a hunt around.

    Squize.

  3. #3
    better than chuck norris
    Join Date
    Jun 2004
    Location
    West Coast of Michigan
    Posts
    667
    I fixed it. I thought it was avatar, but my friend put it under signature.

  4. #4
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    Cool.

    How you testing what you're doing ? Are you ensuring you wait until the loaded swf has actually fully loaded before calling a function on there to start it off ? You using MovieClipLoader class ? Does a trace in the loaded movie work ?

    Really need more info before anyone can be of much help.

    Squize.

  5. #5
    better than chuck norris
    Join Date
    Jun 2004
    Location
    West Coast of Michigan
    Posts
    667
    Well to start, I'm loading the movie using loadMovie("whatever.swf"). I know its loading because I first load a movie.swf that has a bunch of buttons and I can see the buttons after it's been loaded. However, none of them work. I also then load another movie.swf under it and it has this title and it has this script for a ball to go back and forth, but the ball doesn't move when I load it. You asked, are you waiting for the .swf to be fully loaded and the answer is what? lol. I think I know what your asking in which case the answer would be no. The main .swf that loads the others on the first and only frame simply says loadMovie("blah") and again under that loadMovie("blah"), but not actually with blah there, the actual link.

  6. #6
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Are you loading the movies into different levels or into other movie clips? Is the code in loaded swfs using _root variables? A bit code would be nice to see.

    You really should try to use MovieClipLoader class if the Flash version you have supports it.

  7. #7
    Zombie Coder EvilKris's Avatar
    Join Date
    Jun 2006
    Location
    Fukuoka, Japan.
    Posts
    796
    Just a quick but related question;
    Has anybody out there had a problem when loading an swf into a movie clip loads fine, but only once?
    I've got a menu, where you select your stage, and the level pops up, then, in the main.swf I have an enterframe checking for if the user presses 'q'.
    If done so, it unloads the movie and then takes you back to the start menu again. However, when I go back in to the same part, it doesn't load properly again.
    Or perhaps it does load, but immediately I am taken back to the start menu again without having pressed any keys.
    Code:
    _parent._visible = false;
    globalSound = new Sound();
    globalSound.stop();
    
    
    var mcl:MovieClipLoader = new MovieClipLoader();
    
    var mclL:Object = new Object;
    
    mclL.onLoadProgress = function(target, loaded, total) {
    	_root.loader.percent.text = Math.round( (loaded/total) * 100) + "%";
    }
    
    mclL.onLoadInit = function(){
    	_root.loader._visible=false;
    	_root.loader.percent.text="";
    }
    
    mcl.addListener(mclL);
    
    mcl.loadClip("gun2.swf",_root.contents);
    	
    	
    this.onEnterFrame= function()
    {
    	if(Key.getCode()==81)
    	{
    		mcl.unloadClip(_root.contents);
    		_parent._visible = true;
    		_parent._parent.gotoAndPlay("return");
    	}
    }

  8. #8
    better than chuck norris
    Join Date
    Jun 2004
    Location
    West Coast of Michigan
    Posts
    667
    This is basically all I could in the main .swf, the rest of the code is in kSiteTitle and kSiteMenu. I decided to keep this simple and make a simple website for the time being. Here's all the code in the main swf that holds everything.

    code:

    _root.Title.loadMovie("kSiteTitle.swf", "GET");
    _root.MENU.loadMovie("kSiteMenu.swf", "GET");


  9. #9
    better than chuck norris
    Join Date
    Jun 2004
    Location
    West Coast of Michigan
    Posts
    667
    title is just a blank movie clip on the stage and MENU is also a blank movie clip on the stage. so shouldn't it load both kSiteTitle and kSiteMenu and run the script? is "GET" the problem? any help is appreciated.

  10. #10
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    The loading itself does not run any scripts inside the loaded clip. When you say none of the buttons work in loaded movie, what code do you have on those buttons?

    It should work with GET method same way, but I dont usually use it. If it works without specifying GET then I recommend remove it and just use string with the name of swf.

  11. #11
    better than chuck norris
    Join Date
    Jun 2004
    Location
    West Coast of Michigan
    Posts
    667
    The script for 1 of the buttons is
    code:

    on (press) {
    _root.holder.loadMovie("news.swf");
    }


    As before, it loads the clip, but none of the script runs.
    So basically I have my main movie, which I use to load a menu. From the menu I load more movies.

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