Is it possible to remotely detect the version of an swf file with some actionscript code? For instance, you type the url of an swf file, and it shows you the version.
like:
http://xamplesite.com/test.swf
and it says
swf version x.x.x.x
or whatever.
Printable View
Is it possible to remotely detect the version of an swf file with some actionscript code? For instance, you type the url of an swf file, and it shows you the version.
like:
http://xamplesite.com/test.swf
and it says
swf version x.x.x.x
or whatever.
You can detect if it is a AMV1 (AS1 or AS2) movie or not by checking the
event.currentTarget.content
of a loaded swf.
what about as3?
Sure, you will get AMV2 as output.
Ok, thanks. What do I do, load it into a movie clip, run that on the movie clip to equal a variable, and output the variable to a text box or something?
Like:
loadbtn.onRelease() {
var output;
loadMovie(movietoload.text, loadermc);
event.loadermc.content = output;
outputbox.text = output;
}
Are you using AS2? Then it would not work. You need to use AS3.
whoops, my mind is in as2 mode. How bout this:
stop();
loadbtn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
var request:URLRequest = new URLRequest(movietoload.text);
var loader:Loader = new Loader();
loader.load(request);
addChild(loader);
loadermc.addChild(loader);
event.currentTarget.content = outputtext.text;
};
This works brilliantly, except it doesn't output anything into outputtext.text
Is there a way to output the result of the event.currentTarget.content?
I don't really understand how to use it :confused:
You need to add an eventlistener.
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, completeHandler);
function completeHandler(event:Event):void
{
outputtext.text=event.currentTarget.content;
}
In
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, completeHandler);
CO MPLETE is actually COMPLETE right? Yeah I think it is.
Just tested it, works perfectly for AS1 and AS2, but for AS3, it just loads the movie and nothing outputs to the text. ASMV1 or whatever comes for AS2 and 1, but for AS3, nothing. But the movie loads though. Any problems here? This is the code I'm using:
Code:stop();
loadbtn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
var request:URLRequest = new URLRequest(movietoload.text);
var loader:Loader = new Loader();
loader.load(request);
addChild(loader);
loadermc.addChild(loader);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
function completeHandler(event:Event):void {
outputtext.text=event.currentTarget.content;
}
};