|
-
Remotely detecting swf version
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.
-
Senior Member
You can detect if it is a AMV1 (AS1 or AS2) movie or not by checking the
event.currentTarget.content
of a loaded swf.
- The right of the People to create Flash movies shall not be infringed. -
-
-
Senior Member
Sure, you will get AMV2 as output.
- The right of the People to create Flash movies shall not be infringed. -
-
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;
}
Last edited by Obidos; 11-24-2008 at 02:06 PM.
-
Senior Member
Are you using AS2? Then it would not work. You need to use AS3.
- The right of the People to create Flash movies shall not be infringed. -
-
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
Last edited by Obidos; 11-24-2008 at 02:56 PM.
-
Is there a way to output the result of the event.currentTarget.content?
I don't really understand how to use it
-
Senior Member
You need to add an eventlistener.
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, completeHandler);
function completeHandler(event:Event):void
{
outputtext.text=event.currentTarget.content;
}
- The right of the People to create Flash movies shall not be infringed. -
-
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;
}
};
Last edited by Obidos; 11-26-2008 at 02:05 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|