ActiveDen

Help Please to run this program succussfully using Action Script 3

2 posts
  • Has been a member for 0-1 years
Berpke says

var Xpos:Number = 110; var Ypos:Number = 180; var swf:MovieClip; var loader:Loader = new Loader();

var defaultSWF:URLRequest = new URLRequest(“Clip1.swf”);

loader.load(defaultSWF); loader.x = Xpos; loader.y = Ypos; addChild(loader); ////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////

// Btns Universal function function btnClick(event:MouseEvent):void {

removeChild(loader); var newSWFRequest:URLRequest = new URLRequest(“swfs/” + event.target.name + ”.swf”);

loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeF); loader.load(newSWFRequest); loader.x = Xpos; loader.y = Ypos; addChild(loader); }

function completeF(e:Event):void{

var mc:MovieClip=MovieClip(e.target.loader.content);

mc.addEventListener(Event.ENTER_FRAME,mcCheckF);

}

function mcCheckF(e:Event):void{

var mc:MovieClip = MovieClip(e.target);

if(mc.currentFrame==16){

playF(mc,16,20,12);

}

if(mc.currentFrame==21){

playF(mc,21,30,20);

}

}

// Btn listeners Clip1.addEventListener(MouseEvent.CLICK, btnClick); Clip2.addEventListener(MouseEvent.CLICK, btnClick); Clip3.addEventListener(MouseEvent.CLICK, btnClick); Clip4.addEventListener(MouseEvent.CLICK, btnClick);

function playF(mc:MovieClip,startFrame:int,endFrame:int,frameRate:int):void{

mc.gotoAndStop(startFrame);

if(mc.timer){

mc.timer.removeEventListener(TimerEvent.TIMER,nextFrameF);

}

mc.startFrame=startFrame;

mc.timer=new Timer(1000/frameRate,0);

mc.timer.addEventListener(TimerEvent.TIMER,function(e:TimerEvent){nextFrameF(mc);});

mc.timer.start();

}

function nextFrameF(mc:MovieClip):void{

mc.nextFrame();

if(mc.currentFrame==mc.startFrame){

mc.timer.stop();

}

}

7 months ago
1301 posts
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 1 and 9 items
  • Croatia
  • Referred between 1 and 9 users
Tean says

What do you need help with, whats wrong?

7 months ago
2 posts
  • Has been a member for 0-1 years
Berpke says

I am unable to control the frame rate speed of the loaded swf.

I want to detect the loaded swf for example Clip1.swf and change the FPS for certian frames.

// Btns Universal function function btnClick(event:MouseEvent):void works superb.

I was adviced buy a experienced AS3 programmer in Adobe Forums to use function playF();

I tried and did research still unable to run function playF(); as there are no changes in FPS speed.

Is there a solution. This is the exact code that has to be modified. here I want detect the exact loaded swf and change the frame rate speed of certian frames in it.

var Xpos:Number = 110; var Ypos:Number = 180; var swf:MovieClip; var loader:Loader = new Loader();

var defaultSWF:URLRequest = new URLRequest(“Clip1.swf”);

loader.load(defaultSWF); loader.x = Xpos; loader.y = Ypos; addChild(loader); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Btns Universal function function btnClick(event:MouseEvent):void { } // Btn listeners Clip1.addEventListener(MouseEvent.CLICK, btnClick); Clip2.addEventListener(MouseEvent.CLICK, btnClick); Clip3.addEventListener(MouseEvent.CLICK, btnClick); Clip4.addEventListener(MouseEvent.CLICK, btnClick);

removeChild(loader);
var newSWFRequest:URLRequest = new URLRequest("event.target.name + ".swf");
loader.load(newSWFRequest);
loader.x = Xpos;
loader.y = Ypos;
addChild(loader);

Thank you and God Bless you

7 months ago
1301 posts
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 1 and 9 items
  • Croatia
  • Referred between 1 and 9 users
Tean says

The frame speed of the loaded swf becomes the speed of parent swf.

7 months ago
by
by
by
by
by