[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

auto play a movie after preloader

Posted on 2009-04-16
4
Medium Priority
?
324 Views
Last Modified: 2012-05-06
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

0
Comment
Question by:Johnson_sc
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:ugeb
ID: 24163487
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
 

Author Comment

by:Johnson_sc
ID: 24163673
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
 
LVL 11

Accepted Solution

by:
ugeb earned 750 total points
ID: 24172764
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
 

Author Comment

by:Johnson_sc
ID: 24214537
thanks ugeb, the problem was worked out!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question