We create moving media clips of people moving around websites, coming out from behind web windows, text blocks, etc. so there cannot be a navigation bar attached to the video clip. Is there a way to put the "Pause" functionality somewhere on the web page so the user can pause the video clip? Is there a way to achieve this using ActionScript?
It sounds like you can't have this solved all within Flash but you can have Flash ready for a pause by creating an externally available method in that way the HTML / JavaScript can call your pause command at will.
The steps are relatively easy. The first thing you need to do is expose the Flash method you want that will control the pause of the video such as :
import flash.external.ExternalInterface;
function pauser(isPause:Boolean):Boolean{
return true; //do the actual logic here
}
ExternalInterface.addCallback("pauseVideo", pauser);
The line above told Flash that you want the method 'pauseVideo' to be avilable for external recourses and that its scope will be the second parameter (it can be what ever is logical for your app).
The next step is to validate that your HTML enables code interactions in your Flash anywhere you place this line:
flash.system.Security.allowDomain( sourceDomain);
and in your HTML add this to your Flash HTML code:
<param name="allowScriptAccess" value="always" />
You're almost home, now its time to do some JS and actually call your Flash to pause things:
<script language="JavaScript"> flashObject.pauseVideo(true); </script>
Done. You should have now externally controllable content.
Good luck ;)
_
Ben Fhala
Flash/AS3 School ||
The EventController - open source project || Follow me
@02Geek
P.S. If you want to call my attention to a request
add
@02Geek to the title or twitter
my nickname and a link to your post.
P.S.2. If this helped please support by
twittering/rating/commenting
- it keeps me motivated ;) thanks :P
+