Can I load a swf into my Flex app that loads other swf's?

The code below loads an AS2 swf into my Flex mobile for IOS app and it works.  If that AS2 swf has like a circle in it that runs across the stage, it loads and displays properly when run in FlashBuilder.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                 xmlns:s="library://ns.adobe.com/flex/spark"
                                 xmlns:mx="library://ns.adobe.com/flex/mx"
                                 initialize="init()">
          <fx:Script>
                    <![CDATA[
                              import mx.core.UIComponent;
                              private var request:URLRequest = new URLRequest("http://PATH_TO_AS2_SWF");
                              private var loader:Loader = new Loader();
                              private var myComponent:UIComponent = new UIComponent; 
                              private function init():void{
                                        myComponent.percentHeight = 100;
                                        myComponent.percentWidth = 100;
                                        loader.load(request);
                                        myComponent.addChild(loader);
                                        player.addElement(myComponent);
                    ]]>
          </fx:Script>
          <s:Group id="player"
                               height="100%" width="100%"/>
</s:Application>
But if that AS2 swf loads other swf's, they don't load or display.  My FlashBuilder debugger reports no errors or security sand box violations.   I'm using the most elemental code in my AS2 swf so as to not cause problems.  This is it in its entirety:
this.onLoad = function(){
          _root.loadMovie("http://[PATH_TO_REMOTE_SWF]");
The paths to the remote content are fine because swf's load and display fine from AS2 swf when run on it's own - not embedded in Flex app.  They also load and run fine if I cut out the AS2 swf and access directly from my Flex code.  So I know there isn't a path issue.  More likely not accessing the right layer in the AS2 swf from Flex or something.  Or maybe security sandbox violation but I don't see anything reported in the FlashBuilder debug console.  When run console just reports:
[SWF] SwfMobile.swf - 2,639,761 bytes after decompression
[SWF] assets/swf/AS2.swf - 1,470 bytes after decompression
Is there something inherently wrong with loading swf's that load other things?  Even if I have the AS2 swf load jpgs they don't load so the format of the target content at the end of the chain doesn't seem to be the issue.  Just the act of embedding a swf that loads other things seems to be the problem.

Ah, yes. Using an AVM1 SWF could prove difficult...
I'm going on about 3 hours of sleep at the moment, but let me toss out a few thoughts I have and hopefully something will stick...
Ok, so my first thought what to try and cast the loaded content as a MovieClip and call methods on that, but the fact they are AVM1 throws that out the window.
That leaves LocalConnection, as you mentioned. But this would require you to have code on the receiving end to handle the connection... no good either.
But what if you created a "bridge" in AS2 that holds all the code for the receiving end of LocalConnection (or has the control logic itself, perhaps even eliminating the need for LocalConnection all together!). I think maybe this is what you were trying to do already by loading a SWF into a SWF? Well instead of loading your bridge at runtime, what if you statically linked it into your project as a class?
*a few moments later*
Well it looks like you can in fact link in a a symbol created for AVM1, but it will only come in as a SpriteAsset, and will not include any custom code (which makes sense, since they use entirely different class constructs).
To do the test, I created a symbol exported for actionscript (AS2/Flash8), then linked it in with a CSS style embed. I then instantiated the class and called describeType on it.
So in summery, it looks like calling custom code on the bridge is out (I did not test this extensively, that was just my first impression with this simple test). However, if you may be able to perform the actions you need by attempting to cast the loaded content into something AVM2 can recognize. Apparently it does this automatically when linked in statically, so maybe there is something there worth looking into... mainly, can you do what you need using only the base class and no custom code?
Keep me posted!

Similar Messages

  • 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

  • How can I stop downloading pictures into iPhoto and start down loading into a portable hard drive?

    How can I stop downloading pictures into iPhoto and start down loading into a portable hard drive?

    You could use the Image Capture application.

  • Can you import more pictures into a photo book that is already in work?

    Can you import more pictures into a photo book that is already in work? I have already spent many hours trying to create a photo album but came across more pictures to choose from. However, I don't know how to get these new pictures into the "list" of potential photos for the book in progress. I can't stand the thought of having to start over by selecting the 2000 photos plus these new ones and starting all over again!?!

    I have found more pictures that I want to include. They are, say, in a folder on my desktop. I can't simply pull a picture (or the folder) from the desktop and insert it into the album or the list of potential pictures across the top.
    to import into an existing book (which is just a special kind of album) simply drag the photos from their source (the desktop in your example) to the book in the source pane on the left (not to the book in the library window but the book icon in the source pane
    Likewise to use photos from your iPhoto library just drag them from the library to the book
    I also tried imported the pictures, from the desktop folder, into iphoto, creating new event. I don't think there is a way of accessing that new event from the album in work/progress.
    Likewise to use photos from your iPhoto library just drag them from the library to the book in the source pane on the left
    I also tried merging the new "event" into an existing event that I had selected for the album. That doesn't work either???
    That is correct - there is no connection between the source of the book and the book - the book stands alone and you add direct to it in the source pane exactly as you would add to any other album
    LN

  • I have a problem that I can not load or even close the download in iTunes, it turns out I have hanging in the mode, and because of that I can't download from AppStore, because it turns out that the other programs I have on standby. What do I do? Thank you

    I have a problem that I can not load or even close the download in iTunes, it turns out I have hanging in the mode, and because of that I can't download from AppStore, because it turns out that the other programs I have on standby. What do I do? Thank you.

    If there are multiple apps trying to download at once, only one can download at a time and the rest say "Waiting" until it is then their turn. Try this. Double tap the icon of the Waiting app, and it should resume the download.
    If that doesn't work:
    •  Log out of your iTunes store account.  Go to Settings > Store > Sign Out Then press the Home button.
    • Then press and hold the Home and Sleep buttons simultaneously and don't release them when it brings up the Turn Off screen; keep holding them until the Apple logo appears.
    • After restart, the Waiting should be gone.
     Cheers, Tom

  • How CAn I Use a URL variable in Flex App

    Let say the link to a web page embedding a flex 2.0 app is
    http://www.myname.com?name=Bruce
    and I need to use the URL.name variable in the Flex app.
    How can I access URL parameters inside my Flex app?
    Bruce

    You probably know by now but I though maybe a could actualy
    answer someone question.
    {Application.application.parameters.name)
    put that in mx:text and you can see the var "name"

  • I have a production mobile Flex app that uses RemoteObject calls for all data access, and it's working well, except for a new remote call I just added that only fails when running with a release build.  The same call works fine when running on the device

    I have a production mobile Flex app that uses RemoteObject calls for all data access, and it's working well, except for a new remote call I just added that only fails when running with a release build. The same call works fine when running on the device (iPhone) using debug build. When running with a release build, the result handler is never called (nor is the fault handler called). Viewing the BlazeDS logs in debug mode, the call is received and send back with data. I've narrowed it down to what seems to be a data size issue.
    I have targeted one specific data call that returns in the String value a string length of 44kb, which fails in the release build (result or fault handler never called), but the result handler is called as expected in debug build. When I do not populate the String value (in server side Java code) on the object (just set it empty string), the result handler is then called, and the object is returned (release build).
    The custom object being returned in the call is a very a simple object, with getters/setters for simple types boolean, int, String, and one org.23c.dom.Document type. This same object type is used on other other RemoteObject calls (different data) and works fine (release and debug builds). I originally was returning as a Document, but, just to make sure this wasn't the problem, changed the value to be returned to a String, just to rule out XML/Dom issues in serialization.
    I don't understand 1) why the release build vs. debug build behavior is different for a RemoteObject call, 2) why the calls work in debug build when sending over a somewhat large (but, not unreasonable) amount of data in a String object, but not in release build.
    I have't tried to find out exactly where the failure point in size is, but, not sure that's even relevant, since 44kb isn't an unreasonable size to expect.
    By turning on the Debug mode in BlazeDS, I can see the object and it's attributes being serialized and everything looks good there. The calls are received and processed appropriately in BlazeDS for both debug and release build testing.
    Anyone have an idea on other things to try to debug/resolve this?
    Platform testing is BlazeDS 4, Flashbuilder 4.7, Websphere 8 server, iPhone (iOS 7.1.2). Tried using multiple Flex SDK's 4.12 to the latest 4.13, with no change in behavior.
    Thanks!

    After a week's worth of debugging, I found the issue.
    The Java type returned from the call was defined as ArrayList.  Changing it to List resolved the problem.
    I'm not sure why ArrayList isn't a valid return type, I've been looking at the Adobe docs, and still can't see why this isn't valid.  And, why it works in Debug mode and not in Release build is even stranger.  Maybe someone can shed some light on the logic here to me.

  • Can someone tell me how to get my apps that are on my ipad to appear on my TV using Apple Tv

    Can someone tell me how to get my apps that are on my IPad to be viewed on my Apple TV?

    Welcome to the Apple Community Coachcad.
    Basic AirPlay: Assuming both devices are on the same network and that AirPlay is not turned off on the Apple TV, then simply tap on the screen when you are watching content you wish to stream to your Apple TV, then tap the airplay icon that appears in the control bar, choose the Apple TV from the menu that appears.
    Mirroring: When displaying the content you wish to mirror on the iPad 2 (or better), iPad Mini, iPhone 4S (or better), swipe from the bottom of the screen, tap the AirPlay icon and choose your Apple TV from the list of devices (iOS 7 or better) or double tap the home button (quickly) and swipe the bottom row of apps to the right to reveal the playback controls, tap the AirPlay icon and select your Apple TV from the list of available devices (pre-iOS7)

  • How can I get a refund for an unwanted app that I just purchased?

    How can I get a refund for an unwanted app that I just purchased?

    Click here and ask the iTunes Store staff for a refund. Consider whether or not you want to do this now carefully first; if they grant one, you'll need a very good reason to get another from them.
    (111524)

  • Is there a way to create my own app store that I can share with employees? I'm thinking apps that we've identified as important or needed, all in one place.

    Is there a way to create my own app store that I can share with employees? I'm thinking apps that we've identified as important or needed, all in one place.

    Not exactly your own app store, but close.  Apple has an App Store Volume Purchasing Program for Business > http://www.apple.com/business/vpp/
    It allows you to purchase apps in any quantity you desire and pay using a company credit card.  You will receive a spreadsheet of redeem codes which you distribute to your emloyees.  The program guide has complete information > http://images.apple.com/business/docs/VPP_Business_Guide_US.pdf

  • I have an iPad that has one app that loads to only 72%. Apple tells me that the app is no longer available in canada but it has content that I paid for. How do I get the app to work again?

    I have an iPad that has one app that loads to only 72%. Apple tells me that the app is no longer available in canada but it has content that I paid for. How do I get the app to work again?

    If it's not available in your country and you do not have a copy of it in iTunes backed up on your computer, you don't.

  • Can I get an older version of an app that is compatible with my IOS?

    Can I get an older version of an app that is compatible with my IOS? I understand that time marches on, and I'll miss out on newer apps and features, but there really should be a way to get the latest app that is available for your specific IOS. I think this is the one thing that makes me seriously consider dropping iPhone for Android/Google/Windows. 

    Thanks for the quick reply Niel! Well, I followed your instructions, and since it is an Apple App (Podcasts), they don't allow the older version evidently. It just grinds my gears. I get that it is no longer supported, and it may not work with newer podcasts, but let me deal with it not working on everything. As it is, it won't play anything since I can't download it! Thanks again.

  • TS2771 can i retrieve bbm msgs on my ipod 5 that the other contact has deleted?

    can i retrieve bbm msgs on my ipod 5 that the other contact has deleted?

    What do you mean by " other contact has deleted"?
    If they were on your iPod and you backed up then and not backed up after they deleted then restoring from backup may restore those messages. You would have to check with BB/go to their support site
    iOS: Back up and restore your iOS device with iCloud or iTunes

  • Hoy can I get my information back from an app that I erased?

    Hoy can I get my information back from an app that I erased?

    App data is included in the backup.  If you backed up your iPad while this app was still on it, and haven't backed up again since erasing it, restoring to this backup should restore the app data.

  • Inserting external swf "Widgets" into a Flex app

    Hi.
    I need to insert several external widgets into my Flex application. For example the Twitter flash widget and flickr slideshows widget.
    Those widgets normally give you HTML code to insert in your HTML page, like:
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0" width="290" height="350" id="TwitterWidget" align="middle">
        <param name="allowScriptAccess" value="always" />
        <param name="allowFullScreen" value="false" />
        <param name="movie" value="http://static.twitter.com/flash/widgets/profile/TwitterWidget.swf" />
        <param name="quality" value="high" />
        <param name="bgcolor" value="#000000" />
        <param name="FlashVars" value="userID=xxxxxx&styleURL=http://static.twitter.com/flash/widgets/profile/smooth.xml">
        <embed src="http://static.twitter.com/flash/widgets/profile/TwitterWidget.swf" quality="high" bgcolor="#000000" width="290" height="350" name="TwitterWidget" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="userID=xxxxxx&styleURL=http://static.twitter.com/flash/widgets/profile/smooth.xml"/>
    </object>
    I'm trying to achieve the same goal in my Flex application using the SWFLoader control, but I've got a lot of troubles starting with security issues, and although I just learned to pass the FlashVars values, I don't know how to pass the "<param" values.
    public var twitterWidgetSrc:String = "http://static.twitter.com/flash/widgets/profile/TwitterWidget.swf?userID=xxxxxx&styleURL=h ttp://static.twitter.com/flash/widgets/profile/smooth.xml";
                <mx:SWFLoader
                    id="twitterWidget"
                    source="{twitterWidgetSrc}"
                    height="290" width="350"
                    init="setSecurity();">
                </mx:SWFLoader>
    Is there an easier way to insert these widgets into my Flex application? or how can I complete the SWFLoader to achieve the same results?

    I don't mean to disappoint you, but your Idea is impossible due to security violation
    if you'll look inside this file http://static.twitter.com/crossdomain.xml
    you'll probably find out that your host isn't listed there, so you will be not able to load any twitter stuff
    Detailed info you could catch in here:
    http://www.adobe.com/devnet/flashplayer/articles/flash_player_9_security.pdf
    The only way to get the widget embed and working is through HTML

Maybe you are looking for

  • SAP MMC changes green to yellow automaticlly

    HI experts    recently i installed a ides 5 with oracle 9i,ides is running for a week normally,but yesterday ,SAP MMC suddenly automaticlly changes green to yellow and SAPGUI can't be logged on. Below is LOG from SAPMMC Severity     Time     Typ     

  • Changing Customer Credit Limit

    Hi All, Could you please let me know how to change the Credit Limit of a Customer? I know that we can view these changes in FD24 or S_ALR_87012215  transaction code.

  • Service Entry Approval in Workflow

    hi, i have developed workflow for service entry release. When executing workitem in SBWP, workflow getting executed , but service entry sheet is not released. I doubt the release strategy for service entry sheet have to configure correctly for the ag

  • Error "Specifed Key not found" while installing Oracle 11g R2 db

    Hi, I am new to installing oracle 11gr2 DB. While installing at the stage of "install product" during the process of .Copy files its throwing the following error *Specified Key not found Please help me solving this problem. Your help is much apprecia

  • Reading from a server

    I'm supposed to read the following C struct from a server struct query_type{ int flag; int query_a; int query_b; char next pass[30]; typedef struct query_type t_query; I tried Socket s = new Socket( serverName, serverPort ); DataInputStream dis = new