Ultrashock Forums > Flash > ActionScript
AS2 - loadMovie question

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
AS2 - loadMovie question
Old 2008-06-19

Hi there, I don't really know much of AS, have two questions on this.

1st - when setting loadMovie it gives three variables (url, target, method);

What does "method" stand for here?

2nd - What works better?

_root.myContainer.loadMovie("myMovie.swf");

or

_root.loadMovie("myMovie.swf", "myContainer")
postbit arrow 5 comments | 8057 views postbit arrow Reply: with Quote   
Registered User
gabrielsj is offline
seperator
Posts: 32
2007-05-04
seperator

Ultrashock Member Comments:
Isocase's Avatar Isocase Isocase is offline Isocase lives in United States 2008-06-19 #2 Old  
Here is from the help documents, and it only shows two parameters that you can pass in.

public loadMovie(url:String, [method:String]) : Void

Parameters

url:String - The absolute or relative URL of a single SWF, JPEG, GIF, and PNG file to be loaded. A relative path must be relative to the SWF file at level 0. Absolute URLs must include the protocol reference, such as http:// or file:///. For more than one SWF, JPEG, GIF, or PNG, use subsequent calls to loadMovie().

method:String [optional] - Specifies an HTTP method for sending or loading variables. The parameter must be the string GET or POST. If no variables are to be sent, omit this parameter. The GET method appends the variables to the end of the URL and is used for small numbers of variables. The POST method sends the variables in a separate HTTP header and is used for long strings of variables.
Reply With Quote  
gabrielsj gabrielsj is offline 2008-06-19 #3 Old  
Last edited by gabrielsj : 2008-06-19 at 12:17.
that's strange! if you type inside the actions box "loadmovie" it will open:
Code:
loadMovie(url, target, method);
But I'm guessing that your approach is more high standard. I'm not even using :Void.

I am having some issues with my buttons. They all stand inside an external swf (interface.swf) that has been loaded into my project = "main.swf".

Now on root, I've set on last frame that "news" will be my first movie to be loaded in:
Code:
_root.currMovie = "news";
_root.newsContainer.loadMovie(_root.currMovie+".swf");
and for all my external buttons I set up this: (ex: portfolio button)
Code:
this.onPress = function() {
	//unload other movies
	_root.contactContainer.unloadMovie("contact.swf");
	_root.aboutContainer.unloadMovie("about.swf");
	_root.newsContainer.unloadMovie("news.swf");
	if (_root.currMovie == undefined || _root.currMovie != "portfolio") {
		_root.currMovie = "portfolio";
		_root.portfolioContainer.loadMovie("portfolio.swf");
	} 
}
when I go and preview it on my computer, it works fine! But when up on the server, as I click on the "portfolio" button, it unloads all swfs as shown on the actions, but doesnt load in my portfolio.swf. And if I then click on another button and reclick the "portfolio button", now it works loading in.

So there is some issue blocking on first click.
Reply With Quote  
SightStorm's Avatar SightStorm SightStorm is offline SightStorm lives in United States 2008-06-19 #4 Old  
ActionScript Code:
  1. this.onPress = function() {
  2.     //unload other movies
  3.     _root.contactContainer.unloadMovie("contact.swf");
  4.     _root.aboutContainer.unloadMovie("about.swf");
  5.     _root.newsContainer.unloadMovie("news.swf");
  6.     if (_root.currMovie == undefined || _root.currMovie != "portfolio") {
  7.         _root.currMovie = "portfolio";
  8.         _root.portfolioContainer.loadMovie("portfolio.swf");
  9.     }
  10. }

not sure if you missed that "
Reply With Quote  
gabrielsj gabrielsj is offline 2008-06-19 #5 Old  
Last edited by gabrielsj : 2008-06-23 at 09:57.
sorry, fixed that, i wrote it badly up there.
...just solved my problem on that part, but...

I'm noticing that when I load in a external swf, it's preloader never works, always gets all bytes before even showing the preloader, small or big files, it doesnt really matter the size. I'm woundering if this approach isn't wrong.

On my main fla I have that button:
Code:
this.onPress = function() {
	if (_root.currMovie == undefined || _root.currMovie != "portfolio"){
	_root.currMovie = "portfolio";
	_root.portfolioContainer.loadMovie("portfolio.swf");
	}
      }
... and on my first frame inside the portfolio.swf I have this:
Code:
stop();
var loadingCall:Number = setInterval(preloadSite, 50);
function preloadSite():Void {	
	var siteLoaded:Number = getBytesLoaded();
	var siteTotal:Number = getBytesTotal();
	var percentage:Number = Math.round((siteLoaded/siteTotal) * 100);
	//my loader movieclip
	centerLoader.percent.text = percentage + "%";

	if (siteLoaded>=siteTotal) {
		clearInterval(loadingCall);
		gotoAndStop(2);
	}
}
Where am I going wrong?
Reply With Quote  
gabrielsj gabrielsj is offline 2008-06-23 #6 Old  
I updated my issue on post above. thanks
Reply With Quote  
Thread Tools
Display Modes Rate This Thread
Rate This Thread: