SwishTalk.com
 

Go Back   SwishTalk.com > .:: THE HELP DESK ::. > » SWiSH Max4 General Help

Reply
 
Thread Tools Display Modes
#1   [RESOLVED]Need help for loadmovie function!  

Name: 
mAlam
Status: Offline
Rank: SWiSHer
Posts: 9
Old 05-20-2012, 06:43 AM Reply With Quote


Greetings every one..

i m facing a problem as i am very new to swish max 4.

i use following code to load a external swf file
Code:
onFrame (1) {
    loadMovie("A1.swf");
}
it works. but the problem is, what i need, i need to know when that loaded movies end so, i can do others thing like load 2nd movie..

for example i there is 3 movie in the folder (a1.swf, a2.swf and a3.swf)

i like to load next one when previous one is finished

i hope i am clear

any help will be highly appreciated..

best regards




               
 
View Public Profile Send a private message to mAlam Find all posts by mAlam Add mAlam to Your Contacts
#2    

Name: 
OutCast**NL
Status: Offline
Rank: SWiSHer
Posts: 647
Old 05-20-2012, 07:26 AM Reply With Quote


You can compare _currentframe vs _totalframes, like:

Code:
if(_currentframe  == _totalframes){
	//load next movie
	}


               
 
View Public Profile Send a private message to OutCast**NL Visit OutCast**NL's homepage! Find all posts by OutCast**NL Add OutCast**NL to Your Contacts
#3    

Name: 
mAlam
Status: Offline
Rank: SWiSHer
Posts: 9
Old 05-20-2012, 08:27 AM Reply With Quote


Quote:
Originally Posted by OutCast**NL View Post
You can compare _currentframe vs _totalframes, like:

Code:
if(_currentframe  == _totalframes){
	//load next movie
	}
thanks a lot for your reply.. but where to place that code?




               
 
View Public Profile Send a private message to mAlam Find all posts by mAlam Add mAlam to Your Contacts
#4    

Name: 
OutCast**NL
Status: Offline
Rank: SWiSHer
Posts: 647
Old 05-20-2012, 09:01 AM Reply With Quote


It depends how your file is setup,..
But the script below would load a movie inside a movieclip named "loader"
(placed in the same timeline the script is in) and once the last frame played,
it loads a new movie,..

Code:
onFrame (1) {
    loader.loadMovie("A1.swf")				//load movie 1
}
onFrame (3) {
    if(loader.getPercentLoaded() < 100){		//make shure it is loaded
        prevFrameAndPlay();
        }
}
onFrame (5) {
    if(loader._currentframe  < loader._totalframes){	//if not reached last frame,..
        prevFrameAndPlay();				//loop	
    }else{						//else load next movie
        loader.loadMovie("A2.swf");        
        }
}



               
 
View Public Profile Send a private message to OutCast**NL Visit OutCast**NL's homepage! Find all posts by OutCast**NL Add OutCast**NL to Your Contacts
#5    

Name: 
mAlam
Status: Offline
Rank: SWiSHer
Posts: 9
Old 05-20-2012, 01:32 PM Reply With Quote


Quote:
Originally Posted by OutCast**NL View Post
It depends how your file is setup,..
But the script below would load a movie inside a movieclip named "loader"
(placed in the same timeline the script is in) and once the last frame played,
it loads a new movie,..

Code:
onFrame (1) {
    loader.loadMovie("A1.swf")				//load movie 1
}
onFrame (3) {
    if(loader.getPercentLoaded() < 100){		//make shure it is loaded
        prevFrameAndPlay();
        }
}
onFrame (5) {
    if(loader._currentframe  < loader._totalframes){	//if not reached last frame,..
        prevFrameAndPlay();				//loop	
    }else{						//else load next movie
        loader.loadMovie("A2.swf");        
        }
}

still, i can't get it to work..

can you please check out the sample file and modify it so, it will work as i wanted.. please?

best regards


Attached Files
File Type: zip Sample.zip (37.5 KB, 27 views)
               
 
View Public Profile Send a private message to mAlam Find all posts by mAlam Add mAlam to Your Contacts
#6    
 
mobosof's Avatar

Name: 
mobosof
Status: Offline
Rank: Administrator
Posts: 16,173
Mood: fandabbydozy
Old 05-20-2012, 03:37 PM Reply With Quote


http://www.swishtalk.com/showthread....t=check+loaded


http://forums.swishzone.com/index.ph...5&#entry168135

same as outcasts script...checks current frame

not tested but for flv's..... This code listens for the video to complete, which triggers a scene change.

nameofFLV.addEventListener("complete", changeScene);

function changeScene() {
gotoAndPlay("Scene 2");


}


               
 
View Public Profile Send a private message to mobosof Visit mobosof's homepage! Find all posts by mobosof Add mobosof to Your Contacts
#7   none  
 
cycle1500's Avatar

Name: 
cycle1500
Status: Offline
Rank: Oberlin, Ohio, USA
Posts: 1,498
Mood: MEAN: Do's not play well
Old 05-21-2012, 05:23 AM Reply With Quote


The code you were given needed a small tweek to stop the continuas looping.
Code:
onFrame (1) {
    loader.loadMovie("A1.swf")                //load movie 1
}
onFrame (3) {
    if(loader.getPercentLoaded() < 100){        //make shure it is loaded
        prevFrameAndPlay();
        }
}
onFrame (5) {
    if(loader._currentframe  < loader._totalframes){    //if not reached last frame,..
        prevFrameAndPlay();                //loop    
    }else{                        //else load next movie
        loader.loadMovie("A2.swf");        
        }
}
onFrame (6) {
    stop();
}
Wayne


Attached Files
File Type: swi Movie1.swi (9.6 KB, 14 views)
               
__________________
The Hairy One
Wayne helps those that helps themselves.
 
View Public Profile Send a private message to cycle1500 Find all posts by cycle1500 Add cycle1500 to Your Contacts
#8    
 
cycle1500's Avatar

Name: 
cycle1500
Status: Offline
Rank: Oberlin, Ohio, USA
Posts: 1,498
Mood: MEAN: Do's not play well
Old 05-21-2012, 06:38 AM Reply With Quote


Ok now that you have looked at all the examples above it's time to move on a little.
This code is easy and will load as many movies as you want.
Code:
onFrame (1) {
var swfs = ["A1.swf","A2.swf","A3.swf","A4.swf"];//here you list all movies to load
var currentMovie = 0;
_root.createEmptyMovieClip("clip",0);
_root.clip.loadMovie(swfs[currentMovie]);
_root.onEnterFrame = checkLoadFinish;

function checkLoadFinish() {
if ((_root.clip.getBytesTotal() > 4) && (_root.clip.getBytesLoaded() >= _root.clip.getBytesTotal())) {
delete _root.onEnterFrame;
_root.clip.onEnterFrame = checkPlayFinished;
}
}

function checkPlayFinished() {
if (this._currentframe == this._totalframes) {
//this.stop();
currentMovie = (currentMovie+1)%swfs.length; //goes from 0 to 2 and back to 0
_root.clip.loadMovie(swfs[currentMovie]);
delete this.onEnterFrame;
_root.onEnterFrame = checkLoadFinish;
}
}
}
Wayne


               
__________________
The Hairy One
Wayne helps those that helps themselves.
 
View Public Profile Send a private message to cycle1500 Find all posts by cycle1500 Add cycle1500 to Your Contacts
#9    

Name: 
mAlam
Status: Offline
Rank: SWiSHer
Posts: 9
Old 05-21-2012, 06:46 AM Reply With Quote


Quote:
Originally Posted by cycle1500 View Post
Ok now that you have looked at all the examples above it's time to move on a little.
This code is easy and will load as many movies as you want.
........
Wayne
hi, sir, thanks a lot.. but i m very sorry to say that i can't open your file as my version is 2010.11.02

so, can you help me to lower the version so, that i can open it?

please sir, leave a reply asap

best regards


               
 
View Public Profile Send a private message to mAlam Find all posts by mAlam Add mAlam to Your Contacts
#10    
 
cycle1500's Avatar

Name: 
cycle1500
Status: Offline
Rank: Oberlin, Ohio, USA
Posts: 1,498
Mood: MEAN: Do's not play well
Old 05-22-2012, 06:12 AM Reply With Quote


Why didn't you copy the code I provided above? Here it is again. All you need to do is copy and paste this in the main movie time line. Nothing more to do. Now test in the same spot with your A1.swf and A2.swf
Code:
onFrame (1) {
var swfs = ["A1.swf","A2.swf"] //here you list all movies to load just 
//follow what there,"name.swf"
var currentMovie = 0;
_root.createEmptyMovieClip("clip",0);
_root.clip.loadMovie(swfs[currentMovie]);
_root.onEnterFrame = checkLoadFinish;

function checkLoadFinish() {
if ((_root.clip.getBytesTotal() > 4) && (_root.clip.getBytesLoaded() >= _root.clip.getBytesTotal())) {
delete _root.onEnterFrame;
_root.clip.onEnterFrame = checkPlayFinished;
}
}

function checkPlayFinished() {
if (this._currentframe == this._totalframes) {
//this.stop();
currentMovie = (currentMovie+1)%swfs.length; //goes from 0 to 2 and back to 0
_root.clip.loadMovie(swfs[currentMovie]);
delete this.onEnterFrame;
_root.onEnterFrame = checkLoadFinish;
}
}
}
The version of Max you have is three (3) you posted in max four (4).
Luckily I still have 3. Below is the converted file.
I would recommend you upgrade.

Wayne


Attached Files
File Type: swi swishmax3.swi (4.9 KB, 11 views)
               
__________________
The Hairy One
Wayne helps those that helps themselves.

Last edited by cycle1500; 05-22-2012 at 06:17 AM..
 
View Public Profile Send a private message to cycle1500 Find all posts by cycle1500 Add cycle1500 to Your Contacts
#11    

Name: 
mAlam
Status: Offline
Rank: SWiSHer
Posts: 9
Old 05-22-2012, 06:18 AM Reply With Quote


Quote:
Originally Posted by cycle1500 View Post
Why didn't you copy the code I provided above? Here it is again.
I would recommend you upgrade.

Wayne
once again thanks a lot.. and also sorry not to update earlier..

i already used that code and its works like charm

once again.. thanks a lot sir

btw it will be my pleasure if you check out the attached file.. and also sir, for your kind information my swish is 4 not 3

btw. please sir, check out the file .. (attached)

best regards


Attached Files
File Type: zip Banner.zip (1.6 KB, 29 views)
               
 
View Public Profile Send a private message to mAlam Find all posts by mAlam Add mAlam to Your Contacts
#12    
 
cycle1500's Avatar

Name: 
cycle1500
Status: Offline
Rank: Oberlin, Ohio, USA
Posts: 1,498
Mood: MEAN: Do's not play well
Old 05-22-2012, 06:35 AM Reply With Quote


Your banners look and work fine.
All thats needed is upgrading. There are alot more things that can be done with the latest version of Max4.

Wayne


               
__________________
The Hairy One
Wayne helps those that helps themselves.
 
View Public Profile Send a private message to cycle1500 Find all posts by cycle1500 Add cycle1500 to Your Contacts
Advertisement:





Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump