Groups | Blog | Home
all groups > flash actionscript > may 2006 >

flash actionscript : loadmovie problem


Kevin0612
5/17/2006 8:51:59 PM
I have a flash web site and I'm trying to load a flash publicity in this flash
web site.

I'm using
pub.loadmovie(path);

where pub is the occurance where I want to position it.

My problem is that at the end of this animation I need to load another one at
the exact same position wich I can't do.
All I'm able to do is load something at the top left corner.
What do I have to put at th end of my publicity to make it load on the pub
occurance ?
blemmo
5/17/2006 10:28:08 PM
A simple way is to replace "this" at the end of pub1.swf:
this.loadMovie("pub2.swf");

The loaded movie takes the instance properties of the MC it's loaded into, so
when you load pub1.swf into the 'pub' instance, the 'this' keyword inside
pub1.swf will point to the 'pub' instance, just as if you said
pub.loadMovie("pub2.swf");

You could also just place a stop() in the last frame of pub1.swf, and watch
the loaded MC from the main timeline:
_root.onEnterFrame = function(){
if (pub._currentframe == pub._totalframes){
pub.stop();
pub.loadMovie("pub2.swf");
delete this.onEnterFrame;
}
}

cheers,
blemmo
Kevin0612
5/17/2006 10:45:58 PM
Well I found that I will have more then one publicity ( thanks to my boss who
doesn't tell me everything)
I'm using a php file that will do the ramdom and get the variable of the path
in a mysql database, because pub will be on different server.

So what I have right now is this to make it work

loadVars = new loadVars();
loadVars.load("<a target=_blank class=ftalternatingbarlinklarge
href="http://127.0.0.1/baseball/pub.php");
loadVars.onLoad">http://127.0.0.1/baseball/pub.php");
loadVars.onLoad</a> = function(success) {
if (success) {
pub.loadMovie(this.var1);
} else
{
pub.loadMovie("pub1.swf");
}

What do I need to add to this to make it watch when the pub1.swf stop and load
my php file again that will do the random ?
Kevin0612
5/17/2006 11:07:00 PM
Humm I have a little problem a bit different now.
I will have more then 2 pubblicity. and I want them random...
What I'm doign is this for the first one :

loadVars = new loadVars();
loadVars.load("pub.php");
loadVars.onLoad = function(success) {
if (success) {
pub.loadMovie(this.var1);
} else
{
pub.loadMovie("pub1.swf");
}
}

This is all working find
Now at the end of each pub I put the fallowing but it not working at all the
first pub that load just loop..

loadVars = new loadVars();
loadVars.load("pub.php");
loadVars.onLoad = function(success) {
if (success) {
this.loadMovie(this.var1);
}
}
blemmo
5/17/2006 11:22:40 PM
When you use 'this', be careful what it refers to in the context it's used. In
the onLoad() event of a LoadVars objects it refers to that object (as in every
event), so you can't use 'this.loadMovie(...)' there. Try
'this._parent.loadMovie(...)' or '_root.pub.loadMovie(..)' instead.
Kevin0612
5/17/2006 11:36:36 PM
AddThis Social Bookmark Button