# as3 code to support swf player with control buttons

**URL:** https://forum.kirupa.com/t/as3-code-to-support-swf-player-with-control-buttons/325520
**Category:** flash
**Created:** [October 20, 2011, 9:39am UTC](https://forum.kirupa.com/t/as3-code-to-support-swf-player-with-control-buttons/325520 "2011-10-20T09:39:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![msksanthu](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@msksanthu](https://forum.kirupa.com/u/msksanthu)
#### Post date: [October 20, 2011, 9:39am UTC](https://forum.kirupa.com/t/as3-code-to-support-swf-player-with-control-buttons/325520/1 "2011-10-20T09:39:41Z")

</div>

i need code for swf player.the player consists of play, pause ,stop, next and previous with seek bar and time control.i had try my code which not support my swf …the code is …  
function swfLoadedHandler(e:Event):void {  
trace(“swf loaded”);

currentSWF=MovieClip(swfLoader.content);

playerSwf.btForward.addEventListener(MouseEvent.CL ICK, button\_forward);  
playerSwf.btRewind.addEventListener(MouseEvent.CLI CK, button\_rewind);  
playerSwf.btPause.addEventListener(MouseEvent.CLIC K, button\_pause);  
playerSwf.btPlay.addEventListener(MouseEvent.CLICK , button\_play);

currentSWF.addEventListener(Event.ENTER\_FRAME , checkLastFrame);  
}

function checkLastFrame(e:Event):void {  
if (currentSWF.currentFrame==currentSWF.totalFrames) {  
currentSWF.stop();  
}  
playerSwf.sliderMc.width=(currentSWF.currentFrame/currentSWF.totalFrames)\*140;  
}  
function button\_forward(e:Event):void {  
currentSWF.nextFrame();  
}

function button\_rewind(e:Event):void {  
currentSWF.prevFrame();  
}  
function button\_pause(e:Event):void {  
currentSWF.stop();  
}  
function button\_play(e:Event):void {  
currentSWF.play();  
}

swfLoader.load(swfFile);

playerSwf.container.addChild(swfLoader);

function closePlayer(e:MouseEvent):void {  
playerSwf.container.removeChild(swfLoader);  
removeChild(player);  
}  
}

pls help me with another code to run my swf with player…and i had attached my swf and player pls help me frds…
