#1
[RESOLVED]Need help for loadmovie function!
|
| |
|
|
05-20-2012, 05:43 AM
|
|
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
|
|
|
|
|
|
|
|
| |
|
|
05-20-2012, 06:26 AM
|
|
You can compare _currentframe vs _totalframes, like:
Code:
if(_currentframe == _totalframes){
//load next movie
}

|
|
|
|
|
|
|
| |
|
|
05-20-2012, 07:27 AM
|
|
Quote:
Originally Posted by OutCast**NL
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?
|
|
|
|
|
|
|
|
| |
|
|
05-20-2012, 08:01 AM
|
|
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");
}
}

|
|
|
|
|
|
|
| |
|
|
05-20-2012, 12:32 PM
|
|
Quote:
Originally Posted by OutCast**NL
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
|
|
|
|
|
|
|
| |
|
|
05-20-2012, 02:37 PM
|
|
|
|
|
|
#7
none
|
| |
|
|
|
|
|
|
|
|
Mood: MEAN: Do's not play well |
|
 |
|
|
05-21-2012, 04:23 AM
|
|
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
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
Mood: MEAN: Do's not play well |
|
 |
|
|
05-21-2012, 05:38 AM
|
|
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
|
|
|
|
|
|
|
| |
|
|
05-21-2012, 05:46 AM
|
|
Quote:
Originally Posted by cycle1500
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
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
Mood: MEAN: Do's not play well |
|
 |
|
|
05-22-2012, 05:12 AM
|
|
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
|
|
Last edited by cycle1500; 05-22-2012 at 05:17 AM..
|
|
|
|
|
| |
|
|
05-22-2012, 05:18 AM
|
|
Quote:
Originally Posted by cycle1500
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
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
Mood: MEAN: Do's not play well |
|
 |
|
|
05-22-2012, 05:35 AM
|
|
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
|
|
|
|
|
|
|
|
|
|