auto play a movie after preloader

Hi everyone!

I have a file .fla and what happen is:
preloader -> botton saying 'play intro' -> movie

However I'd like to have it working as:
preloader -> movie

It is an intro for a website, so it's convenient to play automatically after load. I tried for 2 days figure it out, but didn't work.

I found the following code:

thanks!

 
// apparently the code from the preloader
 
onClipEvent (load) {
	total = _root.getBytesTotal();
}
onClipEvent (enterFrame) {
	loaded = _root.getBytesLoaded();
	percent = int(loaded/total*100);
	text = percent+"%";
	gotoAndStop(percent);
	if (loaded == total) {
		_root.gotoAndPlay(2);
	}
}
 
 
 
 
 
// this is the code from the botton "play intro"
on (release) {
	play();
	_parent.play();
 
}

Open in new window

Johnson_scAsked:
Who is Participating?
 
ugebCommented:
You said the code was working before, you just had to press the button, right?

From the code you initially posted, what is the _parent?

instead of
_root.gotoAndPlay(31);

you could try
_parent.play();

I'm just not sure what _parent is in this case.  apparently root is not the parent, so you need to find the parent and have it play from frame 1.





0
 
ugebCommented:
Hi,

Just get rid of the button altogether.

Replace the line in your onClipEvent function:

 _root.gotoAndPlay(2);

with (probably)

 _root.gotoAndPlay(3);

to bypass the button.

Let me know...


0
 
Johnson_scAuthor Commented:
thank you very much ugeb, for your attention.

I did the changes, but still not working. I the frame 3, 5, 10 and 25... all of them keep falling at the "play intro" bottom. So I realize there is a fade animation when chick at the falling bottom, so I select a frame very far, like 31, and the screen got stuck in 100% ( the screen show repeatedly 100%).

The last changes is coded below.

 
onClipEvent (load) {
	total = _root.getBytesTotal();
}
onClipEvent (enterFrame) {
	loaded = _root.getBytesLoaded();
	percent = int(loaded/total*100);
	text = percent+"%";
	gotoAndStop(percent);
	if (loaded == total) {
		_root.gotoAndPlay(31);
	}
}

Open in new window

0
 
Johnson_scAuthor Commented:
thanks ugeb, the problem was worked out!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.