SWFloader loads SWF movie within Flex but not when compiled

When I run my app in Flex, SWFLoader loads the SWF okay as a movie clip but as soon as I Export/Release Build, the new app SWF that is generated won't show the movie clip anymore.  If I take another SWF that is an app (not a movie clip) and give it the movie swf name, my compiled app will show the sub app in a frame.  Why would running something within Flex be any different than running a compiled version?
Here is some of the code:
button1 loads the swf.
button2 loads a sound and when the sound is loaded, the sound is played and the swf is played in onSoundLoaded();
public  function onSoundLoaded(event:Event):void{
var localSound:Sound = event.target as Sound;localSound.play();
var clip:MovieClip = MovieClip(swflodr.content);
clip.play();
private  
function button1Handler(event:Event):void {Alert.show("test 1");swflodr.load(
"dog.swf");Alert.show(
"test 2");}
private  
function button2Handler(event:Event):void
var s:Sound = new
Sound();s.addEventListener(Event.COMPLETE, onSoundLoaded);
var  
req:URLRequest = new URLRequest("test.mp3");
s.load(req);
 private function SwfLodrEventHandler(event:Event):void { 
var clip:MovieClip = MovieClip(swflodr.content);clip.gotoAndStop(1);
Alert.show(
"The event loader is ready");}
thanks, Mike

Maybe timing?  The child SWF may not be fully loaded.  Sounds and SWFs are asynchronously loaded.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui

Similar Messages

  • Url links in swf work in standalone, but not when opened in browser

    I am currently using flash to create an electronic press kit.
    In that, i have 2 links to youtube (since embedding the videos was
    not an option, making the file too large), and one link to
    yousendit for the viewer to be able to download a pdf file.
    Now when i open the swf by double clicking on it (which i can
    do, but when on another computer, that has flash player installed,
    the swf will not open unless opened through a browser....not sure
    if that is just something where you can open an swf strictly by
    itself only if you actually have flash or what....that is another
    issue), but anyways, when i open the swf by itself, the links work
    correctly. once opened through a browser, the links do not work.
    Safari error:
    Adobe flash player has stopped a potentially unsafe
    operation.
    The following local application of your computer or network:
    (location of swf on harddisk)
    is trying to communicate with this internet-enabled location:
    youtube.com
    To let this application communicate with the internet, click
    SETTINGS.
    You must restart this application after changing your
    settings.
    Of course i did that, and it didnt happen.
    My question is however, even if this is a simple security
    issue/setting within the browser, is there any way to get around
    this? Because when sending this press kit out, the last thing i
    want is for the viewer to have to take the time to change their
    browser settings and try to get this to work and all that stuff.
    Any help would be appreciated.
    You can also download this swf at the following link:
    http://www.yousendit.com/transfer.ph...661F585ACE0521

    The reason the swf doesn't open up by itself on other
    computers is that it needs a Stand Alone Flash Player to do so.
    Most people have the Flash plug-in for their browsers, but not the
    stand alone player. If you are sending it out as a self contained
    file you need to make a Projector file. It contains the SA + swf in
    one file, which adds weight. Also, you need to make a Windows one
    and and a Mac one. If you are using CS3, I think you can make a
    Abobe AIR app that is universal, granted you install the free AIR
    plug-in controlls for Flash ( I THINK. My knowlege is not totally
    up to date) .
    As for the links not working in the browser, its seems like
    they should work. Your posted link for the file is broken, so
    couldn't see. What is your code for the buttons? Are you calling
    JavaScript in your html page? I've had problem with that usually a
    syntax error or IE.
    AS2 button

  • SWF plays in preview but not when published

    I have seen similar issues posted but none dealing with this
    precise problem. I have two SWFs, one of which loads at the end of
    the other. When SWF 1 is played back in Flash or when published in
    HTML format, SWF2 plays as is should. When SWF is exported to
    another program (e.g. Frontpage or Ektron, CMS), SWF2 will not
    play. Interestingly, when SWF2 is exported to the other program on
    its own, it plays fine so font support is not an issue.
    I have also tried altering the level in the LoadMovieNum
    script (0, 1, 2) as well as republishing both SWFs from the
    original FLA file. So far zippo.
    Any ideas??

    At least on my side it only plays the first video and does not progress.  There are twenty-five videos after this, they are all very short  but they progress.   Is this progressing for you?  Perhaps it is my computer if so. Please let me know.
    Thanks again,
    Mark.

  • EncryptedLocalStore... works in debug, but not when compiled.

    Okay, so I looked around the forum and saw a couple of people with this same problem, but their solutions didn't seem to help me. I don't know if it's because I didn't understand them, or what.
    Here's my problem.
    I've written a nifty little AIR app (AIR 1.5), using Aptana, JavaScript (jQuery) and HTML. The app works perfectly when run from the debugger inside of Aptana.
    However, when I deploy the application (sign it with my self-signed certificate, etc.) and then install it, all of the ELS functionality ceases to work.
    I'm obviously not the first person this has happened to, but I don't know what it is that I'm doing wrong.
    If it helps, here is the code for my DataStoreManager:
    var DataStoreManager = function(){
         return{
              __insert: function(key, data){
                    * function to insert data into the local encrypted datastore
                    * @author: Chris Jordan
                    * @date: 03/22/2010
                    * @param: key - the key to save the data to in the encrypted store.
                    * NOTE:
                    *  This now relys on the global AppConfig object rather than any passed in values.
                   var my = {};
                   //serialize the AppConfig object
                   my.serializedAppConfig = jQuery.toJSON(data);
                   my.byteArray = new air.ByteArray();
                   my.byteArray.writeUTFBytes(my.serializedAppConfig);
                   air.EncryptedLocalStore.setItem(key, my.byteArray);
                   em.dispatchEvent("DataStorageComplete");
              __read: function(key){
                    * function to read data from the local encrypted datastore
                    * @author: Chris Jordan
                    * @date: 03/23/2010
                   var my = {};
                   //get the byteArray back out of the encrypted local store
                   my.byteArray = air.EncryptedLocalStore.getItem(key);
                   if(my.byteArray != null){
                        //if we got something back, then read it and return it.
                        return my.byteArray.readUTFBytes(my.byteArray.bytesAvailable);
                   else{
                        return "";
              __remove: function(key){
                    * function to remove data from the local encrypted datastore
                    * @author: Chris Jordan
                    * @date: 03/23/2010
                   air.EncryptedLocalStore.removeItem(key);
    BTW, is there a better way to insert code snippets into a forum post? I just manually edited the html to make it a bit nicer to look at. Anyway, that aside, I'm hoping that someone can help me with my real issue.
    Thanks!

    Okay, so I switched from using the ELS to just writing my serialized string out to a file. This didn't fix my problem though. The app still behaves the same way. Only now, I can monitor that file that I'm writing the serialized string to, for changes and I learned something by doing this.
    My app has a config screen that gathers three pieces of information and stores it. So the user opens this screen, adds the data, and clicks save to write the data to a file, and close the window. So the end result of clicking save is that the config window closes (after having written the data to file).
    When I export the app and run it, I add some data and click save, but the window doesn't close. I can, at that point look at the config file and see that the data has indeed been serialized and written to the file. It just appears that the screen hasn't closed. So, I click save again (what else am I going to do?). This time the window closes, but an empty string has been written out to the file replacing the config string I had out there to begin with!
    So when I saw this behavior I immediately thought that maybe I had a timing issue. I should probably explain that I'm using jQuery (.bind and .trigger) to implement the observer pattern in this app. So, when I click the "Save" button, an event gets dispatched telling the app to write the data down to the disk. When that's done the function that is doing the writing announces that it's done saving, and in response to that announcement I dispatch two other events. One to close the config window, and one that rebuilds a menu using the new config data. These last two events should be mutually exclusive. They don't depend on each other. But just in case, I have tried just dispatching the close window event, and commenting out the rebuild menu event. That didn't help at all.
    So, like I said, maybe I've got some kind of timing issue here. So I took my dispatchEvent function and wrapped it in a timer.
    //the way my dispatchEvent function used to look (without the timer)
    var em = function(){
        return {
            dispatchEvent: function(e, o){
                jQuery(document).trigger(e,[ o || null ]);
    //new and improved function with a timer...
    var em = function(){
        return {
            dispatchEvent: function(e,o){
                var my = {};
                my.timeout = setTimeout(function(){
                    jQuery(document).trigger(e,[ o || null ]);
                },100);
    However, for all this... the timer didn't change things at all. I tried 100 milliseconds and 500 milliseconds. No difference. So, maybe it's not a timing issue... I don't know.
    This is really bugging the crap out of me. I'm doing something wrong I guess, but I can't seem to figure out for the life of me, what the hell it is! Maybe I've just been staring at the code too much, but I could really use a hand. Has anyone else ever encountered this kind of thing before?
    I'm starting to wonder what sort of apps have been written for the AIR platform using JavaScript. Is this happening because of the way I'm implementing the observer pattern or what? I know that last one would be difficult to answer without having all my code to look at, but I'm not beyond thinking that I've just done something wrong on that front.
    BUT...
    It works PERFECTLY when being run from within the IDE (again, that's Aptana in this case).
    What gives?
    Thanks for reading. I hope someone out there can help me.

  • Customized chrome works when running, but not when compiling ?

    Dear webmates :
    I have customized my chrome in Flex : it does not show the window container  (transparent) , etc... and works great when I run it... however, when I compile it in order to have the standalone file... it simply works displaying again the window ! what do I have to do ? thanks in advance...

    Hello,
    When you built your installer, did you include all of the dynamically called VIs?  The application builder does not know about dynamically called VIs unless you specifically tell it about them (which of course makes sense, as they are dynamic).  Other potential issues might be the change in behavior of the Current VI's Path constant, or a lack of other dynamically called objects such as dlls or drivers.  Make sure that the dynamically called VIs have been properly installed on your target computer in the desired paths.  If that doesn't solve the problem then make sure that your application has good error handling capabilities (i.e. handles all error wires and eventually passes them to an error handler) so that you can use the error to determine which files are missing or in the wrong location.
    Regards,
    Ryan K.

  • Error running demos but not when compiling?

    Hi!!
    I can't run the mail demos they just return with errors like this:
    Exception in thread "main" java.lang.NoClassDefFoundError: msgshow
    I have put the classpath into my system variables under win2003 server like this:
    Name: Value:
    CLASSPATH e:\web_progs\jaf\activation.jar;e:\web_progs\javamail\mail.jar
    I have also tride running the set command at the prompt with above values, no diffrent.
    I'm running everything on a Windows 2003 Server and Java SDK 1.4.2_04.
    Everything else works on the system, just not the javamail function.
    I have searched the forum a.s.o. but only found tips on adding the classpath into windows
    system variables, setting them at the prompt a.s.o. have tried them all no luck.
    Thanks in advance
    Marcus

    I got it to work, added a . when setting the classpath at the prompt.
    Now i just have to figure out how to get the damn webpage to work(not my build).
    /Marcus

  • Load swf works in Publish Preview but not when published

    Hi Folks,
    I having a problem where im trying to load two 1mb SWF movies into my Flash piece. It works fine in Publish Preview but not when I finally publish. I get this error in IE:
    SecurityError: Error #2000: No active security context.
    I have googled around and there is some talk online of a hack where by you get a timeout to overcome this. However im not so technical do I dont really know how to do this to my code in AS3. My code at the moment is below.
    Any help would be much appreciated and rewarded with Karma
    movieClip_12.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_9);
    var fl_Loader_9:Loader;
    //This variable keeps track of whether you want to load or unload the SWF
    var fl_ToLoad_9:Boolean = true;
    function fl_ClickToLoadUnloadSWF_9(event:MouseEvent):void
    if(fl_ToLoad_9)
      fl_Loader_9 = new Loader();
      fl_Loader_9.load(new URLRequest("search.swf"));
      addChild(fl_Loader_9);
    else
      fl_Loader_9.unload();
      removeChild(fl_Loader_9);
      fl_Loader_9 = null;
    // Toggle whether you want to load or unload the SWF
    fl_ToLoad_9 = !fl_ToLoad_9;
    movieClip_14.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_10);
    var fl_Loader_10:Loader;
    //This variable keeps track of whether you want to load or unload the SWF
    var fl_ToLoad_10:Boolean = true;
    function fl_ClickToLoadUnloadSWF_10(event:MouseEvent):void
    if(fl_ToLoad_10)
      fl_Loader_10 = new Loader();
    fl_Loader_10.load(new URLRequest("refunds.swf"));
      addChild(fl_Loader_10);
    else
      fl_Loader_10.unload();
      removeChild(fl_Loader_10);
      fl_Loader_10 = null;
    // Toggle whether you want to load or unload the SWF
    fl_ToLoad_10 = !fl_ToLoad_10;

    I think this is either a problem with my site preLoader or my external .swf Loader. I was checking out the bandwith profiler and saw something weird and I wondered if anyone could explain...I've added a picture. I have a blank frame on only my actions layer to export classes to and it seems that frame 2 is "bleeding" into frame 1. Could this be my problem? Why would this happen? Thanks

  • G5, 10.3.9,Safari will not load.  aol will download but not upload. ?

    My g5 , 10.3.9, will not load safari, aol will download but not up load.  Safari just bonces when trying.  On aol I get a 513 error message when trying to upload.
    whats going on?
    John

    Success. I discovered the issue that was preventing QTSS start up.
    The IP Bind tab listed a set of new Class C IP addresses that ARIN forced us to move to last year and which had been properly configured into our network and I had checked the matching address shared in our new web server config.
    However /library/quicktimestreaming/config/streamingserver.xml had not exterminated the obsolete address and I pico'ed in the Terminal to replace these lines
    <LIST-PREF NAME="bindipaddr" >
    <VALUE>old ip</VALUE>
    <VALUE>new ip</VALUE>
    </LIST-PREF>
    with this line, which will now overide whatever's poking in the old ip, probably one of those pesky permanently-burned Net Info DB's that can't be purged despite the reality that servers sometimes need wholesale refreshes to be re-networked:
    <PREF NAME="bindipaddr" >new ip</PREF>

  • My ipod has had a previous owner How do I change my ipods email address so that when I try to down load anything it asks for the previous owners password but when I go to my account it says its my email my account but not when I try to download????

    My ipod has had a previous owner How do I change my ipods email address so that when I try to down load anything it asks for the previous owners password but when I go to my account it says its my email my account but not when I try to download can anyone please help me ????Plus it still has some of the previous owners pictures and videos on it that I want to delete and can't????? Also is there a way to kill the apps that u have used throughout the day the battery doesn't last long at all ??????

    - How did you dlete stuff from the iPod? If you have a 1G or 2G iPod and deleted the stuff by going to Settings>Genera.>Reset>Erase aall contents and settings without being connected to a power source, the battery dies before he erase was comleted since it can take hour.
    - In any event try the following:
    - Connect to a chaging sour for three hours.
    - Reset the iPod and then connect to the computer and try to restore va iTunes.
    Reset iPod touch:  Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Next try placing the iPod in recovery moe and then try to restore. For recovery mode:
    iPhone and iPod touch: Unable to update or restore
    - Last try DFU made and restore.
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings

  • HT204291 I have iOS 6.0 installed. Im trying to mirror a rented movie from ipad to TV via apple TV. I can hear the movie through TV but not picture (which is still on ipad)

    I have iOS 6.0 installed. Im trying to mirror a rented movie from ipad to TV via apple TV. I can hear the movie through TV but not picture (which is still on ipad)

    Restart you iPad http://support.apple.com/kb/HT1430
    Restart your Apple TV http://support.apple.com/kb/HT3180
    Make sure AirPlay Mirroring is enabled http://support.apple.com/kb/HT5209

  • I have several ipod nanos. i can sync one, but since i connected the ipad 2 I am getting an error on two of them, it says cannot sync, error 13019. the loaded songs show on the computer (on the ipods), but not when the ipod is plugged off the usb

    i have several ipod nanos. i can sync one, but since i connected the ipad 2 I am getting an error on two of them, it says cannot sync, error 13019. the loaded songs show on the computer (on the ipods), but not when the ipod is plugged off the usb. Any answers? please

    You can sync your iPod with multiple computers, but what can be synced is very limited.  See this article for more details.
    http://support.apple.com/kb/ht1202
    B-rock

  • My trackpad is not responding properly on MacBook Pro.  Can move the cursor but not click on icons or similar items.

    My trackpad is not responding properly on MacBook Pro.  Can move the cursor but not click on icons or similar items.

    Intel-based Apple Portables: Troubleshooting unresponsive trackpad issues

  • Apple TV3 will not load a movie I have rented. When I go to Settings/iTunes store/rented movies it still will not load.

    Apple TV3 will not load a movie I have rented. When I go to Settings/iTunes store/rented movies it still will not load.

    Thanks, that worked. Much appreciated.
    john Galizia

  • I would like to create a playlist of some of my voicememos to hear on my iphone5. I have no problem creating the list and can listen on playlist on computer but not when i sync to my phone. How can I listen to voicememos in a playlist on my iPhone?

    I would like to create a playlist of some of my voicememos to hear on my iphone5. I have no problem creating the list and can listen on playlist on computer but not when i sync to my phone. How can I listen to voicememos in a playlist on my iPhone?

    Hi czigrand,
    Thanks for visiting Apple Support Communities.
    Currently, you can gift dollar amounts or individual items (EG. songs) on the iTunes Store. See this article for more information:
    In the iTunes Store, you can gift a dollar amount or specific music, movies, TV shows, or apps from your iPhone, iPod touch, iPad, Mac, or PC. Follow these steps to send a gift from the iTunes Store.
    iTunes: Sending iTunes Gifts
    http://support.apple.com/kb/HT2736
    Best Regards,
    Jeremy

  • I imported photos from an old iPhoto (2001) to photo library and can now see them as thumbnails but not when I click on them. The screen is black cannot see or print either. Is there any way to salvage those old photos? I now use iLife09. OS 10.6

    I imported photos from an old iPhoto (2001) to photo library and can now see them only as thumbnails but not when I click on them. The screen is black cannot see or print either. Is there any way to salvage those old photos? I now use iLife09. OS 10.6

    Did you import the old iPhoto library into the new one? That's not what you want to do because you will import all of the original, modified and thumbnail files as if they were original files. Lots of duplicates and useless small photos.
    Do you have a backup copy of the library that you imported into to?  If you do then bring it in and then use  iPhoto Library Manager to merge the two libraries into a new, 3rd library.
    If you don't then you'll have to try to fix the current one and then cull out the duplicates and small useless photos as follows:  make a temporary, duplicate copy of your library and apply the three fixes in order as necessary.
    Fix #1
    1 - delete the iPhoto preference file, com.apple.iPhoto.plist, that resides in your HD/User/Home()/ Library/Preferences folder.
    2 - delete iPhoto's cache file, Cache.db, that is located in your HD/User/Home()/Library /Caches/com.apple.iPhoto folder. 
    3 - launch iPhoto and try again.
    NOTE: If you're moved your library from its default location in your Home/Pictures folder you will have to point iPhoto to its new location when you next open iPhoto by holding down the Option key when launching iPhoto.  You'll also have to reset the iPhoto's various preferences.
    Fix #2
    Launch iPhoto with the Command+Option keys held down and rebuild the library.
    Select the options identified in the screenshot. 
    Fix #3
    Using iPhoto Library Manager  to Rebuild Your iPhoto Library
    Download iPhoto Library Manager and launch.
    Click on the Add Library button, navigate to your Home/Pictures folder and select your iPhoto Library folder.
    Now that the library is listed in the left hand pane of iPLM, click on your library and go to the File ➙ Rebuild Library menu option
    In the next  window name the new library and select the location you want it to be placed.
    Click on the Create button.
    Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments but not books, calendars or slideshows. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory.
    If this doesn't fix the problem you'll have to start over from scratch and create a new library from the files inside the Originals folder of your current library.  But first you should cull out the small photos that would be the thumbnails from the 2001 library.
    Move the Originals folder to the Desktop, open and do a search for Kind=photo, File size is less than 10 KB.  That should find all of the thumbnail files which you can then drag to the Trash.  You might have to make that less than 50 KB. Then Import the remaining photos into a new iPhoto library.
    OT

Maybe you are looking for

  • Photo stream will not work in Aperture

    I have photo stream and sharing set up on iCloud and when signed in Aperture keeps asking me to sign in when I check the box to set up Photos stream. There is an obvious logic error as the message to sign in on iCloud will not go away even though I a

  • Getting error in each and every scenario

    Hi, I am getting Error as "HTTP response contains status code 503 with the description service unavailable" at SXMB_MONI in each every scenario like FIle to File, FIle to IDOC and vice versa, IDOC to JMS and vice versa, File to JDBC, HTTP to IDOC, JM

  • Can Not Import Files

    This is starting to **** me off...first I have to redo all my movies all over again since I got imovie '08, now it won't import my movies. I have files on my external drive in a .mov file trying to import into imovie. never a problem with version 5 o

  • Transferring files from Mac OS 9.2.2 to external hardrive, then to new iMac

    Please bear with my lack of computer vernacular, I have loads of graphics and photos on Zip disk storage. I want to buy a new computer, however I can not figure out if I should buy a external hard disk first, store all my zip files onto this external

  • About short table scans

    Hello, everyone: I have a question about the "short table scans". Through the DB-Reports, I found in some time intervals there are too many short table scans. How can I identify the sql-statement, which lead to the high short table scans? Thanks :-)