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.

Similar Messages

  • 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.

  • 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

  • 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.

  • Loading an external swf with a loader

    I have a .swf that loads different external swf's into
    loaders based on what frame it is in. For all but one frame this
    works fine. There's no lag, they load quickly and can be interacted
    with with no problem. But, for one .swf it gets really choppy. The
    swf itself runs fine but once it is loaded into another swf through
    the loader the performance really goes down the drain. I guess I am
    wondering if anyone has any suggestions or perhaps different
    methods I should try. Thanks in advance.

    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 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 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 that loads an object from url

    i am trying to load an external swf that in turn automatically loads an object. i want the external swf to only be loaded once the object is loaded in it. right now it loads the external swf first and then the external swf loads the object specified at a url...

    thanks kglad. i think i need to try and load the external swf, wait for it to load its object, and then display it... will look into it and get back...

  • 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 and unloading the parent one

    Hi there i have made a navigation in flash and 3 buttons that load some external swf's. Problem is that when they load the parent swf keeps playing in the background. How can i make them play separately and make the navigation stage dissapear completely when they load?

    I have attempted to use the same Loader but it doesnt replace it i dont know why.
    var myLoader:Loader = new Loader();       
    var myLoaderMain:URLRequest = new URLRequest("main1.swf");
    var myLoaderQuiz:URLRequest = new URLRequest("quiz.swf");
    var myLoaderAnimation:URLRequest = new URLRequest("athens_animation.swf");
    var myLoaderVideo:URLRequest = new URLRequest("videogallery.swf");
    videogallerybtn.addEventListener(MouseEvent.CLICK, videoFunc);
    function videoFunc(curEvt:MouseEvent) {
              myLoader.load(myLoaderVideo);
              addChild(myLoader);
    Quizbtn.addEventListener(MouseEvent.CLICK, quizFunc);
    function quizFunc(curEvt:MouseEvent) {
              myLoader.load(myLoaderQuiz);
              addChild(myLoader);
    Animationbtn.addEventListener(MouseEvent.CLICK, AnimationFunc);
    function AnimationFunc(curEvt:MouseEvent) {
              myLoader.load(myLoaderAnimation);
              addChild(myLoader);

  • 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 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 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??

  • 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!

  • Loading an external .swf into an empty container

    I'm loading an external .swf into an empty container.
    Everything seems to work fine except when the .swf is loaded both
    seems to be running extremely sluggish. The button rollovers are
    slow, the page transitions..everything. I can't figure out why it
    is doing this. Both .fla's have the same frame rate. Is there some
    known reason why this might happen?

    well, we've tried that and it is actually a little bit worse.
    Normally i test everything in a browser window anyway. I'm thinking
    it might be a naming issue of some variable or something that is
    the same for both fla's....not sure yet though.

Maybe you are looking for

  • How to delete orphaned events in Calendar?

    OK, so I'm pulling my hair out on this one: I discovered today that my wife's birthday anniversary event got duplicated 3369 times in my iPad calendar... I'm grateful for the reminder, but 3369 times is a bit too much. Ruling out my wife's unlikely h

  • Bean Value display in JSP Page

    Hi, I am trying to display a value stored in my bean on the jsp page. The value is to be displayed on the initial jsp page.    public void doInitialization()           request = (IPortalComponentRequest) this.getRequest();           response = (IPort

  • System Slow/Locking Up

    OS X (10.4.9) is relatively slow running from my internal drive as compared to my external firewire backup drive. This morning the system locked up completely. I rebooted from the external, ran Disk Utility - repaired permissions, then repaired the d

  • Failing to update

    I have a preowned i phone 4s which keeps displaying the previous owners apple id when i want to update apps? how do i reset it to my apple id

  • Another 90b failure - new notebook

    I purchased a new Probook 450 g1 just under a month ago. Last week, I started getting the 90b error. I've cleaned the fan - it wasn't dirty as the machine is new. I verified the fan is running and blowing warm air. I did the hard reset. I did a BIOS