Skip to main content
satyamaheshb90976265
Participating Frequently
July 6, 2017
Question

Query regarding Action Script 3.0 in Adobe Flash Professional CS5

  • July 6, 2017
  • 1 reply
  • 222 views

I used below code in the time line to navigate between swf files if I press on nextBtn, but after 15 to 20 navigations Flash player is getting struck and I was not able to navigate to next swf file. Could you please check the below code and make necessary corrections if there are any mistakes

import flash.events.MouseEvent;

import flash.display.Loader;

import flash.net.URLRequest;

import flash.events.Event;

import flash.events.ProgressEvent;

import flash.events.MouseEvent;

fscommand("fullscreen","true");

nextBtn.addEventListener(MouseEvent.CLICK, nextFile);

function nextFile(evt:MouseEvent):void

{

stop(); // To stop the playing frame and move to next scene on click of next button

var mLoader:Loader = new Loader();

var mRequest:URLRequest = new URLRequest("abc.swf");

/*var i:Number = 0;

for (i=numChildren-1;i>=0; i--)

{

removeChildAt(i);

} */

mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);

mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);

mLoader.load(mRequest);

}

function onCompleteHandler(loadEvent:Event):void

{

addChild(loadEvent.currentTarget.loader);

}

function onProgressHandler(mProgress:ProgressEvent):void

{

var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;

}

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
July 6, 2017

only one swf file is loaded by thta code (abc.swf) so your snippet is not the (only) problem.

[moved from Creative Suites to ActionScript 3]

p.s. please don't cross-post