Need help loading an external SWF

I'm not very proficient in Flash, so any help will be greatly appreciated. I'm trying to load an external SWF with the following code:
T1_Bttn_BloodCar.onRelease = function() {
t1_images_mc.loadMovie("images/T1_Gallery/BloodCar_SWF/T1_BloodCar.swf");
t1_images_mc._alpha = 0;
It loads the SWF, but doesn't play it correctly when I test it. Here's how the loaded movie is supposed to look:
http://www.theroboteye.com/T1_BloodCar.html
But instead, it plays without the transitions, like this:
http://www.theroboteye.com/TRE2009b.html
I've been trying to figure this out for a few days and have tried adding "this._lockroot = true;" to the SWF I'm trying to load, but I can't get it to play correctly. Can anyone tell me what I'm doing wrong? Thanks in advance.

Try using the MovieClipLoader class (loadClip method) instead of the loadMovie method.  That way you can have a listener that waits for the movie to be loaded and then pull it into play, assigning actions and properties to it after the fact.

Similar Messages

  • Need help unloading an External .swf within another external .swf

    My main project loads an external .swf ("room") depending on which button the user clicks. Once that external .swf ("room") is loaded, the viewer chooses a ("demo") .swf to view. I need the "demo" .swf to unload once it is finished playing so that the viewer sees the 1st external .swfs menu again. All .swfs are loaded into an empty loader component. The "demo" swfs were created in captivate thus I don't have access to a timeline for them.
    I imported a .swf into captivate that will call a function at the end ie..._root.unloadCaptivate();
    and I have the following code in the originally loaded .swf
    function unloadCaptivate() {
    mcLoader.unloadClip(accountingLoader_mc);
    btnEndPeriod_btn.enabled = true;
    btnCashCollect_btn.enabled = true;
    btnFinancialMGMT_btn.enabled = true;
    _root.btnHome_mc._visible = false;
    btnAcct_mc._visible = false;
    btnPlay._visible = false;
    btnPause._visible = false;
    That all works fine, but when I load "room" .swfs into the main .swf, the unloadCaptivate(); no longer works...any ideas? Thanks!

    you should be able to use a loop (like onEnterFrame) to check when your demo swf's _currentframe==_totalframes.

  • What is or isn't possible on iOS?  (Not having Loader, loadBytes(), external swfs, etc)

    My basic question is:  "What are the classes which we should not use for iOS using the packager."
    I have been trying for a few days trying to get a simple Flash app to run on the iPad.  A very simple app (with sound!) with just 2 classes works fine (Performance is a whole other issue.  We will get to that).  But if I try anything else, all I get is a white/black screen on the iPad.  So it would be really nice to know what classes, functions, etc we CANNOT use for the Packager.
    I have fairly simple app (not as simple as 2 classes) which loads some art assets via URLRequest/Loader, puts them on the stage.  Fairly common standard practice in AS3.
    I've read about not able to load an external file using the Packager.  So to fix the situation of loading assets, I have looked into the [embed] tag, which seems to work.  I hope the blogger doesn't mind, but this page is an excellent source on what works and doesn't work with the [embed] tag in it's various flavors:  http://www.richardleggett.co.uk/blog/index.php/2010/03/08/flash_builder_and_flash_pro_asse t_workflows.  For example, AS3 in a swf is stripped out from an external swf using [embed].
    The best way to load an external swf file for iOS seems to be using [embed] with "application/octet-stream" and load the swf through ByteArray (Option #4 in the link above).  This works great on the PC.  HOWEVER, on iPad, it fails.  The [embed] tag works on the iPad with the other ways, so my guess is that loadBytes() does not work.  Is this true Adobe/Flash guys?  Can you confirm this?
    My initial question is "why is this not allowed on iOS?".  If it is because of the fact that it uses a Loader, can it be changed so it's not using a Loader to construct a MovieClip?  I have a ByteArray with the raw swf/MovieClip data.  Why can't I construct a MovieClip from it without going through Loader?
    This loadBytes() failure seems to be the only thing preventing me from using the normal pipeline of Flash development in loading external assets.  If there are other ways people have found, please share!
    Now on to performance.  Adobe, can you post some examples/samples of code which runs at decent performance?  Like a "tech demo" of what is possible using the Packager running on iPad/iPhone.  That would be extremely helpful for everyone.  I have done a lot of the optimizing suggestions on various sites and pages ( and by Adobe http://www.adobe.com/devnet/flash/articles/optimize_content_ios.html), but I am not seeing the 30 fps performance that is MORE than possible on iPhone/iPad.  Displaying and moving around Bitmaps (I don't use any vector graphics) should be blazing fast.  Quake runs on iPad without any problems and that code is 10 years old.  Moore's law dictates that drawing Bitmaps using CPU should be faster than a 3D engine written 10 years ago...  I am trying out the new iOS 4.2 which is supposed to be "significantly" better, but I am still stuck on loadBytes().
    So at this point, I am blocked on loadBytes() and my performance for a simple app which draws a few Bitmaps and MovieClips is terrible.  I am hopeful some people out there have figured out some solution (there are lots of clever people out there) and I will stumble on to something.  But being forced to go native Objective-C seems to be my only option at this point.
    In summary, here are the questions I would like to ask the Adobe/Flash group for some more help/information/advise:
    - Why is Loader not allowed on iOS?  Is it a technical limitation of the hardware/os/Flash?  Will it never be supported?  What is the future of this class on iOS?
    - Why is loadBytes() not allowed on iOS?  I have the raw embedded data in memory.  I don't need to make a remote call so security should not be an issue.  Can I create a MovieClip without using Loader?
    - Why is AS3 stripped from the timeline when a Symbol is retrieved using [embed]?  Maybe this is the same reason loadBytes() fails, but if I could use [embed] and get a copy of the Symbol, that is what I need.  (There are issues with the mx.core.MovieClipLoaderAsset/Asset, but it is better than being blocked by loadBytes())
    - What are some apps you guys have written that we can use to compare PC vs iOS?  Again, a "tech demo" or sample code of what you as experts in Packager for iOS have done which runs at decent framerate (30+fps) would be of tremendous help.  If the Adobe/Flash group hasn't gotten the current Packager for iOS to handle more than 50+ 2D Bitmaps on screen running at 30+fps, that would be good to know.  Please let us know what the experts and owners of your software are capable of getting the most throughput using the Packager.  I'd hate to sound a bit fed up/angry, but I think you are wasting a lot of people's time and energy with a piece of software that, to me, seems like it was a bit early to release.  Flash can do some great things.  If it can do it on iOS, even better.  But PROVE it to us that it's possible, before having your customers run into barriers imposed on us by trial and error.
    Thanks.

    I have hardly ever seen a post here from someone at Adobe, so you may need to be patient.
    Read this article, and get its associated demo files, to see some good performing tech demos:
    http://www.adobe.com/devnet/flash/articles/optimize_content_ios.html
    Back to your main point, loaders are working, what isn't working for you is accessing of things in the library of a successfully loaded swf, that have been set to Export for ActionScript. That means that the swf you have loaded has an ActionScript Class, to represent the library symbol. iOS Flash apps are native ARM code, and don't include the virtual machines that a browser plugin has, and so it's not able to interpret ActionScript. That may be why it would fail.
    Now, I can think of at least a couple of reasons why you might want to have external swfs with elements that you want to reuse in the main swf. One would be if you're intending to make a lot of them, like say if you wanted to have an Asteroids game and the ability to use artwork from a set of different swfs. Another reason might be if you want to skin your interface, by taking specific elements from the loaded swf and using them in the main swf. That way you could have artists preparing those swfs for you, and you just include them in your package, and load the one you want.
    There is a way to do either of those things. The second one can be done by having the item as a named symbol on the stage of the loaded swf. With a to-be-loaded swf named "inner.swf", that has a movieclip on its stage named "mc1", this script in the main swf would load that external swf and use its symbol on the main swf's stage, without having to make the inner swf's symbol use ActionScript:
    var req:URLRequest = new URLRequest("inner.swf");
    var ldr:Loader = new Loader();
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
    ldr.load(req);
    function loaded(e:Event) {
    var mc:MovieClip = e.target.content as MovieClip;
    var innermc:* = mc.mc1;
    innermc.x = 50;
    innermc.y = 50;
    addChild(innermc);
    For the other case, you can take the item off the stage of the loaded swf and draw it into a bitmapdata, and then make as many bitmaps from that as you like. Here's the above example, only it adds the original movieclip to the main swf stage, and also creates a bitmap that looks the same:
    var req:URLRequest = new URLRequest("inner.swf");
    var ldr:Loader = new Loader();
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
    ldr.load(req);
    function loaded(e:Event) {
    var mc:MovieClip = e.target.content as MovieClip;
    var innermc:* = mc.mc1;
    innermc.x = 50;
    innermc.y = 50;
    addChild(innermc);
    var bmd:BitmapData = new BitmapData(innermc.width,innermc.height);
    bmd.draw(innermc);
    var bm:Bitmap = new Bitmap(bmd);
    bm.x = 150;
    bm.y = 150;
    addChild(bm);
    So, the thing to learn is that a native ARM code application does not have an ActionScript interpreter in it, and if you need to do something that normally requires interpreting ActionScript, find another way to do it.

  • FAQ: How do I load an external SWF file into a parent SWF file?

    A ton of Flash users visit Adobe’s we site every month wondering  about how to load an external SWF file from within another SWF.
    Adobe's own TechNote on the subject attempts to answer the basic question, along with some common follow-up questions, including:
    How do I load more than one SWF?
    How do I load a SWF into a specific location in the display list?
    How do I resize the loaded SWF?
    How do I set its X and Y location?
    Here are some additional resources that elaborate on loading content and on working with the display list:
    Sample files for the above TechNote. A set of 3 FLA and 3 corresponding SWF files, including a parent SWF and 2 SWFs that the parent loads.
    Help > AS3 Developer’s Guide > Loading an external SWF file
    Help > AS3 Developer’s Guide > Loading display content dynamically
    Loading multiple external SWFs within a main SWF – CreativeCow.net forums
    Video tutorial: ActionScript 101 – Episode 6: Adding named objects to the Stage. By Doug Winnie. An example of how to add the loaded external asset to the Stage and modify its location or other properties.
    Video tutorial: Preloading in ActionScript 3.0.  By Lee Brimelow. A slightly more complicated example, showing how to  make the parent SWF display information about the progress of loading  the external SWF.
    Tutorial: Loading and unloading SWFs - FlashAndMath.com
    This article provides several examples of how to communicate between a parent SWF file and the loaded SWF:
    SWF to SWF Communcation via ActionScript 3.0 (by kglad)

    quote:
    Originally posted by:
    NedWebs
    You now seem to want to get rid of the swf once it has loaded
    and played itself thru. To do that you would need to have something
    in the swf itself that triggers its removal in its last frame. The
    following might work...
    MovieClip(this.parent).removeChild(this);
    Unfortunately I couldn't get this to work. I placed it on the
    last frame of the SWF to be called - is that right?
    I am not sure I am doing it correctly...

  • Loading an external SWF from an external SWF

    Hello,
    I'm somewhat caught between a rock and a hard spot on a flash
    site project. Here is the situation:
    I have created a parent movie (which loads all external SWFs
    inside of it) that has the menu navigation built into it. However,
    my client wants me to place some more links inside of the external
    SWFs that lead to other pages (external SWFs) of the site. Is this
    at all possible? I was hoping there is a way to tell a button in an
    external SWF to make the parent movie switch between external SWFs.
    Any and ALL help is very much appreciated. Thank you.
    Another question: does this involve using the _parent script?
    Elijah

    Hello,
    Thank you for replying. Here is exactly what I'm needing to
    do:
    We will call the parent file "index.swf". Inside "index.swf"
    I have a "holder" for external swf files to load into when I call
    on them from the main menu buttons on "index.swf". When a customer
    comes to the site, the "index.swf" file initially loads
    "welcome.swf". Inside of "welcome.swf", I have some images that I
    want to make into links to other external swf files.
    My problem is when someone clicks on one of those pictures I
    want the "index.swf" file to open up the corresponding external swf
    file in its "holder", where "welcome.swf" currently resides. Also,
    all of these swf files ("index.swf" included) have stand-alone FLA
    files, none are attached to one another. I have never worked with
    "levels" before, would that be necessary in this case? I have
    attached the code for the external swf loader.
    I hope that gives you a better idea of what I'm trying to
    accomplish.
    Thanks again.
    Elijah
    CODE:

  • Loading an external swf with coordinates

    I am using a simple loadMovieNum("movie2.swf",1); to load an
    external swf into my current swf (movie1). I would like to position
    movie2.swf within movie1. I'm sure I need to convey the x,y
    coordinates, but I am not sure where to start. Any help would be
    appreciated.

    It isn't creating it on the fly.
    Insert a new symbol and give it the instance name
    placeholder_mc. Drag that onto your timeline and scale it so that
    it is the exact same size as your external swf. Then just align the
    empty movie clip on the stage where you want to align the external
    swf.
    loadMovie("external.swf",_root.placeholder_mc);
    This just tells it "Okay, take this external flash file, and
    stick it INTO that empty movieclip"

  • Loading an external swf as a different size?

    Hello - this seems like it would be pretty easy, but I couldn't figure it out from searching through Flash's help documentation.
    I'm using Flash CS3 and AS2.0.  I'm using the loadMovie function to load an external swf into an empty movieclip.  The problem is that the external swf is bigger than the frame I am loading it into, so I'd like to load it in with specific width/height parameters (basically load it in and scale it down).
    What would be the loadMovie command to do that with?
    Thanks!!!

    You need to wait for the movie to load before you can change its size.  To know that the movie is loaded you want to use the MovieClipLoader.loadClip method instead of loadMovie.  The loadClip method supports having an evemt listener so that you can know when the file is loaded and ready to use.  If you look up the MovieClipLoader.addListener method in the help docs, there is an example there that should get you thru most of it.  It uses an onLoadInit event listener which is what you'll want to use since you need to wait for the swf file to be loaded and ready for use before you try to affect it.

  • Loading an external .swf to a main .swf

    so i fairly new to flash but had a question about
    loading an external .swf into a mian one. So i was jsut wondering
    if anyone had great links to a site that could help or anyone who
    might want to explain it step-by-step. and one question of my own a
    very stupid one infact if i keep the background white on my .sfw
    that i am going to load into my main one will the background still
    be there when it shows up on my website?
    Any help?
    Thanks...

    Start by reading the Live Docs on the loadMovie() method.
    That will get you headed in the right direction.
    As for the background of the loaded SWF (by which I mean the
    background color as specified in the PI for the document), no, that
    is ignored when loading it into another movie. If you need it to
    have a background, create a new layer at the bottom of the timeline
    and draw a rectangle filled with the color you need before
    generating the SWF.
    Hope that helps!

  • AS2 mc loads 1 external swf from group depending on cookies and .html location

    I am attempting to load an external swf banner into an empty movieclip (main.fla for argument), which seems straightforward enough. But the idea is that each .swf (banner) is a link to its own respective html page. I.E. bannerA.swf links to pageA.html etc.
    The first problem is that I dont want main.fla to display bannerA.swf on pageA.html since the user will already be on pageA. So I need main.fla to recognize the .html page that the user is currently on (I have to do this in one flash file, otherwise I would make 4 which exclude the banner for its own page– though, if this would greatly reduce headache, I might be able to talk the powers that be into it).
    Secondly, I need main.fla to remember which banner (or banners) the user has seen on previous visits to a page so that the banners will rotate with each consecutive visit.
    Im guessing this can be implemented with an array and some listeners, but Im no AS2 guru. Any help would be more than appreciated.
    Thank You,
    Ryan

    Oh, I know I am sorry about that! I have been fiddling around
    and updating that version... I changed it to be a pop-up after I
    posted the question because in the forum for where I purchased the
    main layout template, a lot of people had written in saying that
    they could not get any gallery features to work with the buttons...
    so its something in the main page code, I don't know what.. but I
    am a bit eager to get the site up so I reverted to a pop-up for
    now...

  • How to Load an external swf using loadmovie in AS3

    I need to create a button with script, on rollover load an external swf into movieclip in AS3.  This was able to create this in AS2, but I need to create this in AS3

    Thanks again Ned.
    Kenneth Russell
    graphic artist, Sr.
    Lockheed Martin - MS2
    2323 Eastern Blvd., Baltimore, MD 21220
    Phone 410.682.0554    Fax 410.682.0543
    From: Ned Murphy <[email protected]>
    Reply-To: [email protected]
    Date: Thu, 23 Jul 2009 19:08:25 -0600
    To: kenneth russell <[email protected]>
    Subject: How to Load an external swf using loadmovie in AS3
    In AS3 you use the Loader class to load external swf's and image files.  You
    should be able to find examples both in the Flash help files and these forums
    if you search.  If you aren't aware of how to code buttons in AS3, that can be
    found as well.  In AS3, just about any kind of interction involves the use of
    event listeners in combination event handler functions... in the case of a
    button rollover an example would be...
    btnName.addEventListener(MouseEvent.ROLL_OVER, overHandler);
    function overHandler(evt:MouseEvent):void {
         // your loading code or whatever
    >

  • How can I load an external SWF into a movie clip that's inside other movie clip?

    Hi.
    I creating my first flash (actionscript 3.0) website but I'm
    stuck with a visual effect I want to create.
    I have a window on my website called contentWindow. Every
    time you click a button this window is supposed to leave the stage,
    load the requested content and return to the stage.
    The sliding window is a movie clip with 83 frames, 21 to
    enter the stage, 21 to leave the stage again, 20 for nothing (its
    just to simulate the loading time) and 21 to return to the stage.
    Now my goal is, when the user clicks on a navigation button,
    the window exits the stage, loads an external SWF with the content,
    and then returns to the stage.
    I've the "window" movie clip with an instance name of
    "contentWindow". Inside there is another movie clip with an
    instance name of "contentLoader". The content that the user
    requested should appear inside the "contentLoader".
    Now, when the contentWindow leaves the stage, I get this
    error message:
    quote:
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    at rwd_fla::MainTimeline/trigger()
    If I switch
    "contentWindow.contentLoader.addChild(navLoader);" for
    "contentWindow.addChild(navLoader);" it works fine, but the
    external SWF doesn't move with the window.
    How can I load an external SWF into a movie clip that's
    inside other movie clip?

    Hi,
    Recently, I have been putting together a flash presentation.
    And I am just wondering if the following might help you, in your
    communication with the said swf file:
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    onComplete);
    function onComplete(event:Event):void
    event.target.content.thinggy_mc.y -= 100;
    Not the best example, but this allows you to target a mc
    within an external swf file. I think if you look up this code, you
    will have an answer ;)
    Kind Regards,
    Boxing Boom

  • I need help with controlling two .swf's from third.

    Hi, thanks for reading!
    I need help with controlling two .swf's from third.
    I have a problem where I need to use a corporate designed
    .swf in a digital signage solution, but have been told by the legal
    department that it can not be modified in any way, I also can't
    have the source file yada yada. I pulled the .swfs from their
    website and I decompiled them to see what I was up against.
    The main swf that I need to control is HCIC.swf and the
    problem is it starts w/ a preloader, which after loading stops on a
    frame that requires user input (button press) on a play button,
    before the movie will proceed and play through.
    What I have done so far is to create a container swf,
    HCIC_container.swf that will act as Target for the HCIC.swf, and
    allow me to send actionscript to the file I'm not allowed to
    modify.
    I managed to get that done with the help of someone on
    another forum. It was my hope that the following script would just
    start HCIC.swf at a frame past the preloader and play button, and
    just play through.
    var container:MovieClip = createEmptyMovieClip("container",
    getNextHighestDepth());
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener(this);
    mcLoader.loadClip("MCIC.swf", container);
    function onLoadInit(mc:MovieClip) {
    mc.gotoAndPlay(14);
    But unfortunately it didn't solve my problem. Because there
    is a media-controller.swf, that is being loaded by HCIC.swf that
    has the controls including the play button to start HCIC.swf.
    Here's a link to a .zip file with all 3 .swf files, and all 3
    .fla files.
    http://www.axiscc.com/temp/HCIC.zip
    What I need to do is automatically start the HCIC.swf file
    bypassing the pre-loader and play button without editing it or the
    media-controller.swf in anyway. So all the scripting needs to be
    done in HCIC_container.swf.
    I know this is confusing, and its difficult to explain, but
    if you look at the files it should make sense.
    ActionScripting is far from my strong point, so I'm
    definitely over my head here.
    Thanks for your help.

    Got my solution on another forum.
    http://www.actionscript.org/forums/showthread.php3?t=146827

  • Loading an external .swf then referencing to it's label

    I'm new with Actionscript and am currently working at
    building a website. I've got a lot figured out so far but one
    problem I'm running into is when I try to load an external .swf
    using the loader component and then reference it or try to point to
    it within my main .swf I can only load the "gallery.swf." through
    myLoader.contentPath = "gallery.swf";
    I'm trying to load it and then point to a specific label so
    it loads that frame or label. I've created separate labels for each
    image in my gallery so that when I point to them with AS, it knows
    which image to load. It worked when I had the gallery in the main
    .swf but when I used the loader component it didn't work.
    The AS I used that worked before I made a separate .swf and
    used a loader was:
    on(release) {
    _parent._parent._parent.photos_MC.gotoAndPlay("img1");
    what I thought would work was:
    on(release){
    _parent._parent._parent.myLoader.contentPath =
    gallery.swf.photos_MC.gotoAndPlay("img1");
    I'm probably totally off, but if anyone could help out I
    would appreciate it!

    This looks like AS2 code, you may want to post there.
    Assuming this is AS2 code, the contentPath of the Loader specifies
    the url to load. Once the swf is loaded, you can then gotoAndPlay()
    to the label you want.
    Hope that helps.

  • Loading an external SWF in and displaying it behind overlay/watermark

    I am building a SWF and the goal is to load in an external SWF file and then display that within my container. They are totally unrelated items and I do not want to modify the functionality of the item I am loading in. My SWF will briefly display a watermark overlay, but then disappear. Can anyone guide me into this best way of doing this?
    Also, is there anyway to get the properties from the SWF I loaded in (namely height and width) so I might be able to easily adjust the size of my SWF to match?
    Thanks!

    just load your external swf using the loader class.  what you described doing is standard stuff and nothing special needs to be done.
    however, you must wait until loading is complete before you can access the loaded object's width and height.

  • Loading an external swf into my parent swf?

    Does anyone know how I can load an external .swf file into my
    parent file? I have tried to use loader actionscript but think I am
    using the incorrect script or putting it in the wrong place? If
    anyone can tell me the script and where to/how to use it that would
    be amazing? Thanks

    thanks GWD!
    I am using the unloadMovieNum(); command, i have loaded the
    child into level 5 of my parent swf. the parent has multiple scenes
    this one with a layer with a stop(); action and another layer with
    the loadMovieNum("portfolioone.swf", 5); script. it loads the child
    perfectly. The child has a number of pictures in it and a back
    button at the end. I have been adding the
    on (release) {
    unloadMovieNum(5);
    script to the button which unloads the child but stops
    because of the stop action in the first frame of the particular
    scene within the parent. I want to be able to add a script to this
    button which will take me back to a labeled frame in a particular
    scene of the parent, I tried the this.removeMovieClip(); but
    doesn't seem to be working for me, Thanks for the reply, hope you
    can help me further??

Maybe you are looking for