A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Remotely detecting swf version

  1. #1
    Member
    Join Date
    Jan 2008
    Posts
    35

    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.

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    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. -

  3. #3
    Member
    Join Date
    Jan 2008
    Posts
    35
    what about as3?

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Sure, you will get AMV2 as output.
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Member
    Join Date
    Jan 2008
    Posts
    35
    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.

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    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. -

  7. #7
    Member
    Join Date
    Jan 2008
    Posts
    35
    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.

  8. #8
    Member
    Join Date
    Jan 2008
    Posts
    35
    Is there a way to output the result of the event.currentTarget.content?
    I don't really understand how to use it

  9. #9
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    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. -

  10. #10
    Member
    Join Date
    Jan 2008
    Posts
    35
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center