-
[F8] loadmovie and sequentially playing external swf's
i have searched and searched, and read many tutorials on loadmovie(),
this is my first experience with this function. the tutorials i read all had a button to start the process of playing the swf's .
my situation: i have a container 775x100 in adroll.fla. in that area i would like to load 5 swf's-(ad1,ad2...ad5) and play them sequentially (and then loop those if possible but i would be happy if they just played once thru.)
from a post i found here and tried this code:
Code:
myListener = new Object();
myListener.onLoadComplete(targetClip){
//targetClip is a reference to the movieclip you passed to loadClip();
//respond to completion code
}
myMCL = new MovieClipLoader();
myMCL.addListener(myListener);
myMCL.loadClip("ad.swf", "ad2.swf","ad3.swf","ad4.swf","ad5.swf",myTargetMovieClip);
function()
{for(i=0;i<5;i++)
myMCL.loadClip("mySwf"+i+".swf", _root["target"+i]);
}
my movie adroll.swf will not play!!!-- i get this error
Scene=Scene1, layer=Layer1, frame= 1, line2 syntax error
this is line 2----myListener.onLoadComplete(targetClip){
i have spent a long time on this if someone could look this over and help me to get this to work.
thanks,
craig
-
rename ad.swf to ad1.swf.
replace:
function(){for(i=0;i<5;i++)
myMCL.loadClip("mySwf"+i+".swf", _root["target"+i]);
}
by
PHP Code:
for(i=1;i<=5;i++){ myMCL.loadClip("ad"+i+".swf", _root["target"+i]); }
assuming you have 5 empty clips named target1 to target5 on _root.
and go read on the MovieClipLoader class in the liveDocs (link in my footer)
gparis
And get rid of the first loadClip.
gparis
-
gparis,
thanks for answering so fast. i hate being spoon fed, but i am trying to understand whwat exactly you meant.
1) assuming you have 5 empty clips named target1 to target5 on _root:
well i did not so i created 5 movie clips and named them target 1 to 5
i right click on properties and give it an identifier target 1 to 5 corresponding.
and checked export for actionscript and export in first frame- i do not know if this right.
i am cofused here about the _root.
do i need to provide a path and how to do so?
2)i did go to the link you provided and read that but i did not quite understand it.
3) i am not sure what you mean by the first loadClip i removed the reference
//targetClip is a reference to the movieclip you passed to loadClip();
my code reads like this now:
Code:
myListener = new Object();
myListener.onLoadComplete(){
//targetClip is a reference to the movieclip you passed to loadClip();
//respond to completion code
}
myMCL = new MovieClipLoader();
myMCL.addListener(myListener);
myMCL.loadClip("ad1.swf", "ad2.swf","ad3.swf","ad4.swf","ad5.swf",myTargetMovieClip);
for(i=1;i<=5;i++){
myMCL.loadClip("ad"+i+".swf", _root["target"+i]);
}
i am getting the same error as above--
could you let me know where i am at now
closer or farther away from my solution.
also i am going to put this in a html pge if oyu use php code will i have to rename the page to php?
thanks craig
-
Nevemind the PHP tags, they just give colouring syntax, which makes code easier to read than with the code tags that you used. Code is actionscript.
You cannot load 5 swfs in the same container, since they will replace one another, thus the need to have 5 empty containers, in which you load one swf only.
You can make all containers _visible property to false, and just set that property to true when you want to show its content.
So... Put 5 empty movieclips on the Stage. Give them, via the property panel, the instance names of target1, target2, target3, target4 and target5.
Place the following code in the 1st keyframe of the main timeline.
Assuming your swfs, named ad1.swf, ad2.swf...ad5.swf are in the same folder it should work.
PHP Code:
myListener = new Object();
myMCL = new MovieClipLoader();
myMCL.addListener(myListener);
for (i=1; i<=5; i++) {
myMCL.loadClip("ad"+i+".swf", _root["target"+i]);
}
total_swf = 5;
loaded_swf = 0;
myListener.onLoadComplete = function() {
loaded_swf++;
if (loaded_swf == total_swf) {
trace("all loading is done");
}
};
gparis
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|