load external swf by .extension and get totalFrames

What I'm trying to achieve is dragging and droping a swf in this app all trace its totalframes.

But no luck yet, can't seem to ge the file.extension to load.

code so far:

package

{

import flash.display.Sprite;

import flash.text.TextField;

import flash.filesystem.File;

import flash.events.Event;

import flash.events.NativeDragEvent;

import flash.display.MovieClip;

import flash.desktop.NativeDragManager;

import flash.desktop.Clipboard;

import flash.desktop.ClipboardFormats;

import flash.net.URLRequest;

import flash.display.Loader;

import flash.events.Event;

to import flash.events.ProgressEvent;

import flash.events.IOErrorEvent;

SerializableAttribute public class Main extends Sprite

{

private var dragTarget:Sprite = new Sprite();

private static var myLoader;

var currentfile;

public void Main()

{

addEventListener (Event.ADDED_TO_STAGE, doStage);

}

private void doStage(e:Event):void

{

tv_mc.addEventListener (NativeDragEvent.NATIVE_DRAG_ENTER, doDragEnter);

tv_mc.addEventListener (NativeDragEvent.NATIVE_DRAG_DROP, doDragDrop);

tv_mc.addEventListener (NativeDragEvent.NATIVE_DRAG_EXIT, doDragExit);

}

private void doDragEnter(e:NativeDragEvent):void

{

NativeDragManager.acceptDragDrop (tv_mc);

}

private void doDragDrop(e:NativeDragEvent):void

{

var dropFiles:Array = e.clipboard.getData (ClipboardFormats.FILE_LIST_FORMAT) in the table;

for each (var file:File in dropFiles)

{

Switch (file.extension)

{

case "swf":

path_txt.text = file.nativePath;

CurrentFile = file.extension;

swfLoader.addEventListener (Event.INIT, loader_init);

loadswf();

break;

by default:

path_txt. Text = "a file format not recognized";

}

}

}

private function loadswf (): void

{

trace (CurrentFile)

var mLoader:Loader = new Loader();

var mRequest:URLRequest = new URLRequest (currentfile);

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

mLoader.load (mRequest);

}

private void onCompleteHandler(loadEvent:Event)

{

trace ("Loaded")

}

}

}

any help is welcome!

THX pavel

part of the problem is that this current file gives only the fileextension

CurrentFile = file.extension;

and urlrequest waits the whhole path

var mRequest:URLRequest = new URLRequest (currentfile);

also: If you drag multiple files on your application, you will also encounter problems, rather from the loading immedaiately osf must build smth like a queue of the charger (or throw an exception if multiple files are placed in your app)

Tags: Adobe Animate

Similar Questions

  • Problem with loading external swf files

    Hello

    I am currently working on a project which is an interactive and dynamic elemtry school presentation to the Denmark. I finished my project and it works perfectly, but only locally on my computer.

    The final draft should be implemented on the site and public work. I tried to implement the project on the site and unfortunately, it does not work as expected.

    When all the files where transferred to the ftp server, only a single files are responding and appear correctly.

    Interactivity of the project is based on a structure of Action script, which is based on the smooth transition between swf files (load another swf file after the action is triggered by clicking on a button) do any work.

    After days of trying to figure out the solution, I'm totally lost. One thing is to publish the project so that all action script will work and answer between swf files, and the other thing is to make it user-friendly for the Android and apple products.

    The presentation is quite heavy because of its loading external swf content files, which are images and movies.

    I really hope you can help me with my problem. I will gladly share the files and codes if it would help solve the problem.

    Best regards

    Agata

    It could be a problem of location of file from loading.  When you place a swf file in an HTML base for targeting anything that the SWF load becomes the folder of the html page.  You may need to adjust the target so that the target of swf files, load it as if it were in the same folder as the html page.

  • Load external swf and stopping on the 1st frame.

    Hello everyone

    I use following code to display an external swf file on the iPad.

    var request: URLRequest = new URLRequest ("http://< server ip > / test.swf");

    loader = new Loader();

    Loader.Load (request);

    The file load passes through each image and closes the application.

    Y at - it will be a way to stop the 1st frame once the file is loaded and move between the ribs to the?

    Thank you

    If you listen to when the charger is finished, you can stop the swf file:

    var mc:MovieClip;

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, swfloaded);

    function swfloaded(e:Event) {}

    MC = e.target.content as MovieClip;

    MC. Stop();

    }

    Now you can do what you like in this clip. As:

    mc.gotoAndStop ('some ' label');

    or:

    mc.gotoAndStop (10);

  • Load external .swf and button top

    Hello!

    I have a problem here! I want to load a file (created from inDesign) external .swf and then on load a button at home (a small image that I created with the name "home_btn"), which refers to my home page to say frame 90

    Any help it would be greatly appreciated,

    Frank

    I founded by myself, I just create a clip of this button and this is my code in case anyone has the same problem...

    import flash.events.MouseEvent;

    import flash.display.Loader;

    import flash.net.URLRequest;

    var loader: Loader = new Loader();

    Loader.Load (new URLRequest ("MyInDesignSwf.swf"));

    addChild (loader);

    addChild (home_front);

    home_front.addEventListener (MouseEvent.Click, playClickedExit)

    Stop();

    function playClickedExit(event:MouseEvent):void

    {

    removeChild (loader);

    gotoAndPlay (90);

    }

  • How to load external swf file and unload the swf file parent?

    I have a question. Let's say I have file1.swf, file2.swf and file3.swf, how can I link this 3 files together.

    Let's assume that file1.swf is the main content file, but as I load file2.swf, I want the file1.swf get replaced by file2.swf. How could unload file1.swf at that time, so that my file2.swf will become the main content file?

    and even once, when my current post file2.swf and I want it get replaced by file3.swf tinkle of a button. so that i can unload the file2.swf and let them file3.swf become the main content file...
    Anyone have ideas on this?
    Thank you..

    If you're publishing to fp 10 + use:

    var loader: Loader = new Loader();

    var urlR:URLRequest = new URLRequest();

    addChild (loader);

    Btn1.addEventListener (MouseEvent.Click, f);

    btn2.addEventListener (MouseEvent.Click, f);

    function f(e:Event):void {}

    {if (Loader.Content)}

    loader.unloadAndStop ();

    }

    {if(e.currentTarget==btn1)}

    urlR.url = "file2.swf";

    } else {}

    urlR.url = "file3.swf";

    }

    Loader.Load (urlR);

    }

    p.s. Please check the useful/correct, if there is.

  • Loading external swf into an Air application

    Hi all

    I have build an Adobe Air app for desktop PC and have problems to load an external swf. Whenever I try to load, I get:

    SecurityError: Error #2070: security sandbox violation... cannot access stage owned by app... blah blah

    The file is loading is in a local directory, but I understand its in an another "sandbox" that represents a security risk.


    Is there a way to get around this?


    Any help would be appreciated


    Thank you very much


    Matt

    That's why I added these comments on domain of the swf file.  for locally loaded SWF files, use:

    SFMltd wrote:

    Hi Kglad, thanks for the example.

    If I run my class with securityDomain = SecurityDomain.currentDomain; then it throws this error: SecurityError: Error #2142: security sandbox violation: local SWF files cannot use the LoaderContext.securityDomain property.

    The e-mail of swf file trying to load is stored locally, so I guess that this error is logical. However if I comment on this line, I get the same error "cannot access stage owned by app"?

    See below for the class:

    package {}

    import flash.display.MovieClip;

    import flash.filesystem.File;

    import flash.events.Event;

    import flash.net.FileReference;

    import flash.events.MouseEvent;

    import flash.display.Loader;

    import flash.net.URLRequest;

    import flash.system.LoaderContext;

    import flash.system.ApplicationDomain;

    import flash.system.SecurityDomain;

    public class assetPreview extends MovieClip {}

    private var loader: Loader;

    private var mainSWF:MovieClip = new MovieClip();

    public void assetPreview() {}

    addEventListener(Event.ADDED_TO_STAGE, initialise);

    }

    public void initialise(e:Event):void

    {

    removeEventListener(Event.ADDED_TO_STAGE, initialise);

    var allowSWF:LoaderContext = new LoaderContext (false, ApplicationDomain.currentDomain);

    allowSWF.securityDomain = SecurityDomain.currentDomain;

    loader = new Loader();

    Loader.Load (new URLRequest (settingsXML.pathToSWF), allowSWF);

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, viewPreview);

    }

    public void viewPreview(e:Event):void

    {

    addChild (mainSWF);

    mainSWF.addChild (loader);

    }

    }

    }

  • Loading external SWF in as3 SWF Loader style?

    Hello

    I recently did the replacement of as2 as3 and am still struggling to get my head to a particular aspect. I managed to load an external swf into an empty file via the script

    Import LoadDisplayObject;

    var loader: LoadDisplayObject = new LoadDisplayObject ("button_01.swf", true);

    1. loader.addEventListener ("displayObjectLoaded", onComplete, false, 0, true);

    addChild (loader);

    function onComplete(evt:Event):void {}

    trace ("received full load");

    loader.scaleX = loader.scaleY is. 75;

    }

    ... but I'm struggling with the script to make a SWF to load into a space when one of my 3 buttons is activated...

    My page currently has three buttons (button_01, button_02 and button_03) and in a local folder three separate sovereign wealth funds with the same names that I want to load, when you press the appropriate button.

    I managed to get them to load using a tutorial... but what they charge on top of each course... far from ideal. Research on the internet I found a range of different script... goal, that I can't find anywhere that I can find the script to make it work... so why I turned here.

    Any help much appreciated... Thanks in advance.

    Simply call butt1Click (null);

  • Cannot load external swf

    Hello

    Im trying to load an external swf into my project, the code is simply:

    var loader: Loader = new Loader;

    Loader.Load (new URLRequest ("gallery.swf");

    I get an error that says the following when it debug.

    TypeError: Error #1009: cannot access a property or method of a null object reference...
    at gallery_fla::MainTimeline/frame1()
    Cannot view the source code at this location

    I have done this same thing before but never got this error message, I tried to load a swf file that is old and it worked fine.

    IM totally lost here, any help is very appreciated.

    Because the error is pointing Gallery fla, it can be that the problem lies in the SWF Gallery.  What you need to do, is to enter your Setings publish and select the option to enable debugging.  This will help by joining the line number of the code problemed.  You think it's a number of top line to no matter what you have in the file doing the oading that would probably make most issues that's the file you load.

    Just in case you have copied and pasted, the following line should have thrown an error of syntax by lack a parenthesis...

    Loader.Load (new URLRequest ("gallery.swf");

  • Quick Q re: loading external swf in flash

    There is probably an easy fix that I am right on...

    I am building a Web site where I have several external swf that I load it into my main movie through buttons (using release, container.loadmovie ("movie.swf"))

    There is a clip on the main timeline with several thumbnails, which act as buttons to load each swf. Sovereign wealth funds are loaded within the timeline of the movieclip (not the main timeline). When each swf is loaded, there is a 'return to the thumbnails' button for you back to the page of thumbnails on the main timeline.

    Everything works fine, except that when I click on the button "return to the thumbnail" and it brings back me to the miniature screen... the SWF is still visible as a reason any. The button is just redirecting to an image labeled on the main timeline where the miniature screen slides in... but he loses not the swf file and I can not understand how to make it go away.

    Thanks in advance for any help!

    You will probably need to use a unloadMovie command to get the swf to go away (container.unloadMovie ();).

  • Loading external .swf integrated

    OK, here's a doozy (or so I think).  I was invited to take a video on a website (.swf file) and burn it to a CD to the internal office.  Unfortunately, the file .swf on the website is highly integrated, and I tried all possible means to get this file out of the site.  I tried saving the file from my computer and load it with a charger in Flash.  The only thing that works is if I take a .swf embed code and place it on a different Web site, which is not what I am trying to accomplish.  So, my question: is it possible to load an external severely embedded .swf in a Flash movie?  I understand how to load a .swf which may not seriously addressed, but I'm stumped on this one.  I understand that companies really integrate their content so that people can not rip off it, that ' a given.  So there still no way around this?

    I used the CS4 component and the Component Inspector to load the .swf, so I do not have any script to post.  Thank you!

    Im not sure what you mean by "severely embedded?

    You say there's a player out there and you try to download the movie to the player?

  • run the error when go to the "home" button after loading external swf

    I work to develop an Android app to learn Arabic, it's very simple.

    to explain the alphabet, I create and load files SWF external, first and second Chargers work well (loading and when click the buttons there is not any question)

    but the third charger charge well also, but the problem when I test project, I make me run error when press home.

    (it does not occur when you load other chargers)

    Here are the sisters Project.rar Android - Google Drive files

    Thank you

    the problem is in the way that you use to add the listeners to events for the buttons, you add a listener for them different click events each keyframe, so you need to remove the headphones before you leave for another frame.

  • Loading external Swf

    Hi all! I am new to the forum here and relatively new to AS3. I use FlashBuilder code. I'm trying to load a local external .swf into my application. My URLRequest happens not to be able to find the location of the local swf file. I dropped it around with my application, but no matter what I put for the url it does not find the swf file. For example, my swf is game.swf name, but no matter where I put it in the folder of the project and any combination of URL, I can't seem to access. Oddly enough, if it's in the bin-debug and I put URLRequest ("game.swf"), he will find that in the bin-debug, it seems. Please help and thanks in advance!

    In a Flash Builder project you should put it in the folder/src. The bin-debug is generated automatically with whatever you put in / SRC.

    Ideally, you should make a folder under/SRC (so/src/assets) liabilities and then load again URLRequest('assets/game.swf'); Flash Builder copy file /src liabilities more to/bin-debug and your final export file as well.

  • Load external swf from Web site

    Hi guys,.

    I am trying to load an external swf that is downloaded to a folder on my site from a main swf stored locally.  If I use the standard Loader with URLRequest class it doesn't throw any errors, but nothing comes. I need to change some security in my flash file settings to allow this works?

    Thank you very much

    Matt

    the movieContainer class defined in MasterLibrary.swf AND your main swf file?

    If this isn't the case, you can load MasterLibrary into your currentdomain.  If so, you need to reference the application domain the loader:

    public void loaderIOErrorHandler(e:IOErrorEvent):void / / this function is called when the main movie cannot load a local copy of "MasterLibrary.swf".

    {

    loadLibrary = new Loader();

    loaderAppDomain = new ApplicationDomain();  register if required

    loaderContext = new LoaderContext (false, loaderAppDomain);  register if required

    loadLibrary.contentLoaderInfo.addEventListener (Event.COMPLETE, loaded);

    loadLibrary.load (new URLRequest("myDomain/MasterLibrary.swf"), loaderContext);

    }

    public void loaded(e:Event): void

    {

    var:Class=Class(loaderAppDomain.getDefinition("movieContainer)) C;

    var instance: MovieClip = new C();

    addChild (instance)

    }

  • Load external swf file

    Hi all

    I am trying to load an external SWF file in my site... but it does not work. Here is my code

    public var CD:Loader = new Loader();

    protected function application1_creationCompleteHandler(event:FlexEvent):void

    {

    CD.load (new URLRequest ("http://localhost/assets/slide.swf"));

    addChild (this. (CD);

    CD.x = 2;

    CD.y = 170;

    / / TODO self-generated stub method

    }

    Can someone tell me what goes wrong...

    The url is correct and his works in my browser when I type " " http://localhost/assets/slide.swf ' in the browser... So the problem is with flex...

    I tried to load this swf into my project and it crashed the browser.  What is written this swf?  AS3 or earlier?  If I'm not mistaken load one previous VERSION other than 3 will cause additional problems and needs to work to spare but I'm not 100% sure.

  • AS2 button table to load external swf files

    Hey everybody.  Someone here recently helped me tremendously with a question I had on the creation of a back button in my flash file, allowing the user to click the button and view the file before swf.  I hope someone can help me make the next button now, too.

    I have a movieclip that loads an external swf files table.  I thought that the next button would be as simple as changing a selection just few things for the previous button.  However, this does not work.  When I try it, the movieclip doesn't even load the swf files.  Here's my AS2 code for my folder.  I have bolded the part at the end is for the previous button.  Does anyone know how to make the back button?

    var currentSwf:Number = 0;
    var swfs:Array = new Array ("EZSmartStand/SmartStand.swf", "EZSmartStand/Warnings.swf", "EZSmartStand/LCDDisplay.swf", "EZSmartStand/Operation.swf", "EZSmartStand/Harness.swf", "EZSmartStand/Transferring.swf", "EZSmartStand/800lbvid.swf", "EZSmartStand/Ambulating.swf", "EZSmartStand/Accessories.swf", "EZSmartStand/HarnessLaundering.swf", "EZSmartStand/ChargingBatteries.swf", "EZSmartStand/EmergencyLowering.swf", "EZSmartStand/EmergencyLowering2.swf");

    var listener: Object = new Object();
    var mcl:MovieClipLoader = new MovieClipLoader();
    mcl.addListener (listener);

    Function to load the film "next".  It uses the current value of currentSwf
    to access the table of sovereign wealth funds, then increments this value.  This version loops
    around at the beginning after the last of them.

    function loadNext (): Void {}
    mcl.loadClip (SWF [currentSwf], theTargetClip_mc);
    currentSwf ++;
    If (currentSwf > = swfs.length) currentSwf = 0;
    }

    When the SWF load, put in place to constantly check its current image
    against the total number of frames, and so those that match, the SWF is done playing.
    If this is the case, then load the following.

    listener.onLoadInit = {function(targ:MovieClip):Void}
    theTargetClip_mc.onEnterFrame = function (): Void {}
    If (this ._currentframe = this ._totalframes) {}
    loadNext();
    delete this.onEnterFrame;
    }
    }
    }

    loadNext();
    function loadNext (): Void {}
    If (currentSwf > = swfs.length) return;
    mcl.loadClip (sovereign wealth funds [currentSwf], theTargetClip_mc);
    currentSwf ++;

    }

    function loadPrevious (): Void {}

    if(currentSwf>1) {}


    currentSwf-= 2;


    loadNext();


    }


    }

    rewind_btn.onRelease = loadPrevious;

    You must change your code so that the value of currentSwf reflects the real current swf being viewed.  It makes it easier to manage in the aspect of thinking.  While I'm not show all your code, here's how I recommend you change functions, by adding one specifically for loading, and change the other just increment/decrement the value currentSwf.

    function loadNext (): Void {}
    currentSwf ++;
    If (currentSwf > = swfs.length) currentSwf = 0;
    loadSWF (currentSwf);
    }

    function loadSWF (nextSWFToLoad) {}
    mcl.loadClip (SWF [nextSWFToLoad], theTargetClip_mc);
    }

    loadSWF (currentSwf);

    function loadPrevious (): Void {}
    -currentSwf;
    if(currentSwf==-1) currentSwf = swfs.length - 1;
    loadSWF (currentSwf);
    }

    rewind_btn.onRelease = loadPrevious;

Maybe you are looking for

  • I can't play "IheartRadio.

    If I use Firefox and load iheartradio it does not work. If I use IE and load iheartradio it will work

  • Strange question on Satelite R830-1GZ

    Owner for two weeks. Everything worked well, but today I had a strange thing happenI was connected to a Wi - Fi modem. Then I disconnected the modem and signed in btfon. After that, I noticed Skype contacts were not connected, so I have closed Skype.

  • bypassing the Welcome screen in windows xp pro

    I want to bypass the Welcome screen of windows on windows xp pro service pack 3. I tried control userpasswords2 and uncheck and check passwords.  I even tried to disable the Welcome screen.  I tried also even tried to change the type of connection to

  • Remote Desktop XP SP3 timeout

    If a remote desktop session to a XP SP3 running under Active Directory machine is idle for 15 minutes, the following 2 minute warning message is issued: Session has been idle over its time limit. Logoff will start in 2 minutes. Press any key now to c

  • RAID. Invalid firmware.

    Hi all. I get the nex error when starting. Help, please.