@awayfl/avm2
Version:
Virtual machine for executing AS3 code
25 lines (24 loc) • 1.05 kB
JavaScript
import { Errors } from '../errors';
import { isNullOrUndefined } from '@awayjs/graphics';
export function FlashNetScript_navigateToURL(sec, request, window_) {
if (request === null || request === undefined) {
sec.throwError('TypeError', Errors.NullPointerError, 'request');
}
var RequestClass = sec.flash.net.URLRequest.axClass;
if (!RequestClass.axIsType(request)) {
sec.throwError('TypeError', Errors.CheckTypeFailedError, request, 'flash.net.URLRequest');
}
var url = request.url;
if (isNullOrUndefined(url)) {
sec.throwError('TypeError', Errors.NullPointerError, 'url');
}
if (url.toLowerCase().indexOf('fscommand:') === 0) {
var fscommand = sec.flash.system.fscommand.value;
fscommand(sec, url.substring('fscommand:'.length), window_);
return;
}
// TODO handle other methods than GET
//console.log("TODO: FlashNetScript_navigateToURL: FileLoadingService")
window.open(request.url, '_blank');
//FileLoadingService.navigateTo(url, window_);
}