Jump to content
GreenSock

sututuyet

adding play pause stop buttons and seekbar how to??

Recommended Posts

I have used loaderMax to load swf file

but I dont know if i can add a play/pause/stop and a seek bar to control the loaded swf

Please help..

thanks alots

Link to comment
Share on other sites

I am new to greensock and as3

could you give me an example adding play pause stop buttons and seekbar when loading swf

thanks

Link to comment
Share on other sites

to play and pause you just need to target the rawContent of the SWFLoader

 

here is a basic example:

 

import com.greensock.*
import com.greensock.events.LoaderEvent;
import com.greensock.loading.SWFLoader;
import flash.events.MouseEvent;

//hide buttons until swf has loaded
play_btn.visible = false;
pause_btn.visible = false;


var loadedSWF:SWFLoader = new SWFLoader("part1.swf", {container:this, onComplete:setupButtons});
loadedSWF.load();





function playSWF(e:MouseEvent):void{
	loadedSWF.rawContent.play();
}

function pauseSWF(e:MouseEvent):void{
	loadedSWF.rawContent.stop();
}	

function setupButtons(e:LoaderEvent){
play_btn.visible = true;
pause_btn.visible = true;
play_btn.addEventListener(MouseEvent.CLICK, playSWF);
pause_btn.addEventListener(MouseEvent.CLICK, pauseSWF);
}	

 

programming a seekbar is quite involved. perhaps you can find some tutorials on building a seekbar for a movie clip that is on the stage and then apply those concepts to controlling the rawContent of your swf. Unfortunately we do not have the time to provide extensive custom code solutions.

 

attached are files for that contain the code above.

  • Like 1
Link to comment
Share on other sites

  • 2 years later...

Carl, thank you SO much for the above code!! You and Jack are helping me to learn to fish.

 

Happy New Year,

Steve

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×