Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to start a Flash animation from an HTML link?

Status
Not open for further replies.

bouncer1

Technical User
Oct 1, 2006
6
AU
Hi

I have imported a Flash animation into an ordinary HTML page - let's call it myflashproject.swf. So far so good.

I have disabled autoplay, because what I want to do is have an html link that says something like "Click here to play the animation". When that link is clicked, the myflashproject.swf file will start playing.

As a bonus, I would like the animation to stop when that link is clicked again. If that is not possible, then perhaps a diffent link to stop the animation.

Any help would be really appreciated. Pleae be aware that I am a scripting idiot and tend to use WYSIWYG tools most of the time.\

Many thanks.
 
Actually. I have managed to work out how to start the animation, but I need to be clearer about what I am after.

What I would like, is the first frame of the Flash animation to load along with the rest of the HTML page... however, I only want the SWF file to actually start playing the rest of the animation when the HTML link ios clicked.

So far all I get is a blank space on the page, until I click the play button.
 
First of all you need to set "play" attribute in <object>/<embed> to "true" (or remove the attribute) so that your SWF starts playing as soon as loaded. Then just put "stop()" in the frame you want it to hold.

To play/stop the movie from HTML, you can use Javascript:
[tt]
FlashObject.Play();

FlashObject.StopPlay();
[/tt]


Kenneth Kawamoto
 
This is an excellent solution - you may have full control over a flash element from you browser.


**Hey KK, thanks for your help earlier, intrinsic is used to map AS1 classes to AS2 (it's always the easy solution) - Im sure you knew that**


Regards
Liquid Pixel
"...because it wasn't there when I needed it
 
Thanks Keneth

Much obliged.

Another question. Is it possible to advance teh Flash moive one frame at a time using teh same HTML link?

Thanks again.
 
Thanks also Liquid Pixel. I'll have a look at that sie.
 
> Is it possible to advance teh Flash moive one frame at a time using teh same HTML link?
Code:
// JavaScript
var n = [i]FlashObject[/i].TCurrentFrame("/") + 1
[i]FlashObject[/i].GotoFrame(n);

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top