Accessing External swf's library items

Hi,
I am Using AS2 having a Main swf in which i am loading
external swf (I want to access the loaded swf 's library item in
the main swf is it possible), means i want to attach a movieClip
from the second swf, to the first is it possible.

Thanks kglad. It seems that we are bumping up against the
limitations of Flash for building complex applications (and not for
the first time). I come from the Java world, where doing something
like this would be a no-brainer. Claus Wahlers has developed an
AS3 class to
solve this very problem, but unfortunately we are restricted to
AS2 at the moment.
Still, I'm surprised that no one else here has encountered
this issue. For instance, someone who was writing a Flash video
game that loads a new set of assets after each level cleared would
need some way to do this.

Similar Messages

  • Problem with accessing external swf library items

    Hi,
    I have a really annoying problem when I try to access the library items of an external .swf file. It is something I have done many times before using the ApplicationDomain.currentDomain.getDefinition() method. In this particular exmple, however, I am trying to load a .swf file from a full web address rather than locally.
    I can load in the .swf and try to set the application domain like the following
    * Please note that I amu using bulkLoader
    var domain:ApplicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain)
    var lc:LoaderContext = new LoaderContext(false, domain);
    var path:String =  WorldManager.SITE_ROOT + swfPath;
    l.add(path, { id:"Kit", context:lc } );
    l.start();
    The file loads successfully but when I try to access the .swf library assets using the following it cannot access it
    domain.getDefinition("Shirt_B04");
    If I load the file with a relative path it works.....
    Does anyone have any ideas how I can solve this?

    In addition to David's reply, this technote may help:
    http://help.adobe.com/en_US/Dreamweaver/10.0_Using/WSc78c5058ca073340dcda9110b1f693f21-7e6 8a.html

  • AS3 Accessing External SWF objects

    Hello
    I do understand that in Flash 8 (AS2) you can create and
    empty clip, then load SWF file and access objects inside it through
    this movieclip. For example if I have an instance of somethig
    called "inst" and I compile SWF, then after I load it in another
    project I can do MovieClipName.inst._x = 50;
    Now in Flash 9 (AS3) I cant do that, since I have to use the
    loader, and if I try to do LoaderName.inst._x = 50 - that would not
    work. So how should I have to do this now?
    In few words I have a project called MainProject.fla there I
    load up a movie with this:
    var _ldr:Loader = new Loader;
    var _req:URLRequest = new URLRequest("test.swf");
    _ldr.load(_req);
    Now in test.swf I have a bitmap with instance called
    "MyBitmap" . How can I change position of that bitmap in that SWF
    file after I load it?

    Thanks so much! That indeed did work.
    One more question though. Can I add event listeners to the
    objects inside the loaded SWF?

  • How access SWF Library items?

    Is it possible to access SWF Library items from main FLA?
    Ex:
    I am loading swf on level1, i want to access level1 library
    items from level0 file

    You'll need to get the FLA for the file to see how the
    linkage is set up. Other option, though not ideal, is to get ahold
    of a SWF decompiler, and create a new FLA where you know the
    linkage id's.

  • Accessing Loaded SWF Library Items

    In _root level I'm loading a swf that contains button
    skins(In library with linkage names)
    And I want to load a button skin in _root._mc level. I can do
    this using attachMovie but, it adds to _root level because the swf
    is loaded from _root level. But, I want it to be added to _root._mc
    level. Hopefully this is clear.
    1) Load a swf that contains button skins in _root level
    2) in _root._mc using attachMovie add a button skin in
    _root._mc level NOT _root level.
    Thanks,

    >>that doesn't make sense. you can't attach a library
    movieclip that's in loaded swf
    -Yes I can I do this all the time. Once a swf is loaded you
    can load its library items. This is a trick I learned from this guy
    who works for Adobe.
    http://orcad.optimumreturn.com/LoadingLibrary.zip
    Thanks,

  • Get access instances after load an external swf (bulkLoader)

    The problem: how can I get access to instance items after an external swf  loaded?
    My  code:
    var  containerMC:MovieClip;
    var _bulkLoader:BulkLoader=new  BulkLoader("loader");
    _bulkLoader.add("external.swf");
    _bulkLoader.add("image.jpg");
    _bulkLoader.addEventListener(BulkProgressEvent.COMPLETE,
    _onDesignLoadComplete);
    _bulkLoader.start();
    function  _onDesignLoadComplete(event:BulkProgressEvent):void  {
         containerMC=_bulkLoader.getMovieClip("external.swf");
         addChild(containerMC);
        containerMC.sgMC.addChild(_bulkLoader.getBitmap("image.jpg"));  //<--- here it's working, I understand,  why.
    containerMC.sgMC.addChild(_bulkLoader.getBitmap("image.jpg"));  //<--- here it doesn't works....why?

    Hi,
    I use AS project. I wanted to reach instances out of the function, but it seems there is no solution to do that.
    So I have to put the other codes in an another function called from the handler function. But in this case it will be difficult, but not impossible.
    The solution is:
    var  containerMC:MovieClip;
    var _bulkLoader:BulkLoader=new   BulkLoader("loader");
    _bulkLoader.add("external.swf");
    _bulkLoader.add("image.jpg");
    _bulkLoader.addEventListener(BulkProgressEvent.COMPLETE,
    _onDesignLoadComplete);
    _bulkLoader.start();
    function   _onDesignLoadComplete(event:BulkProgressEvent):void  { //in project this is private function
          containerMC=_bulkLoader.getMovieClip("external.swf");
          addChild(containerMC);
        baseFunc(); //call the other function
    function baseFunc():void {//in project this is private function
        containerMC.sgMC.addChild(_bulkLoader.getBitmap("image.jpg"));  //<--- here it will work

  • Loading library assets from external .swf

    Ok, so here's what I want to do. I'm creating an application
    that has optional classes that it can instantiate based on what the
    needs are. These classes operate things like Session Logging
    utilities, etc. These items obviously have assets that they need
    available such as movieclips and buttons. For example, the Session
    Logger has a sessionLog_mc clip that has a log window with buttons
    and the log display. I want to be able to have my class load the
    external .swf that contains the assets for the Session Logger and
    then use attachMovie(), once the .swf is loaded, to attach the
    sessionLog_mc from the library of the loaded external .swf file.
    This does NOT seem to work at all. This seems like it has to be
    possible. I don't want to be forced to put all my code into
    external .swf's too. I just want some external asset .swf's (or
    maybe just one large one) that I can load. Is this possible? I am
    wanting to have the ability to show the progress of loading each of
    these components while the application is starting up and loading
    the asset files. Thanks so much!
    Here is an example of what I'm trying: (the attachMovie does
    NOT work at all)

    I see now how to import and display a library class object
    using:
    var MovieClipClass:Class =
    Class(loader.contentLoaderInfo.applicationDomain.getDefinition("myLibraryAsset"))
    var movieClip:Sprite = new MovieClipClass();
    addChild(movieClip)
    But this seems to only work for SWF's published for AS3 Flash
    Player 9.
    I need to do the same for SWF's published with AS2 Flash
    Player 7.
    Any ideas?

  • External .swf library assets

    Ok, so here's what I want to do. I'm creating an application
    that has optional classes that it can instantiate based on what the
    needs are. These classes operate things like Session Logging
    utilities, etc. These items obviously have assets that they need
    available such as movieclips and buttons. For example, the Session
    Logger has a sessionLog_mc clip that has a log window with buttons
    and the log display. I want to be able to have my class load the
    external .swf that contains the assets for the Session Logger and
    then use attachMovie(), once the .swf is loaded, to attach the
    sessionLog_mc from the library of the loaded external .swf file.
    This does NOT seem to work at all. This seems like it has to be
    possible. I don't want to be forced to put all my code into
    external .swf's too. I just want some external asset .swf's (or
    maybe just one large one) that I can load. Is this possible? I am
    wanting to have the ability to show the progress of loading each of
    these components while the application is starting up and loading
    the asset files. Thanks so much!
    Here is an example of what I'm trying: (the attachMovie does
    NOT work at all)

    Hi Andrei1
    I already have a code that goes embedded in first frame of a
    fla file and it works. The fla has two scenes, one called
    “preloader” and the other just “scene”.
    In the “preloader” scene I have this code in the
    first frame:
    import flash.events.ProgressEvent;
    function LoadingProgress(e: ProgressEvent):void
    var percent:Number = Math.floor(
    (e.bytesLoaded*100)/e.bytesTotal );
    t.text = ""+percent;
    if(percent == 100)
    play();
    loaderInfo.addEventListener(ProgressEvent.PROGRESS ,
    LoadingProgres);
    stop();
    It also has an instance of an animation movieclip in the
    stage that shows the loading progress.
    And in the “scene” scene it has a simple
    instruction as code in the first frame:
    stop();
    And it also has an instance of the main movieclip on the
    stage.
    It works fine, but my version of a separated AS file ( using
    package/class ) is not working.

  • AS3: How to access and control embedded sounds in an external swf?

    I rarely use sounds in AS3/Flash. I am using Flash Pro CS6, but I can't seem to figure out how to access, control (play, stop, etc) sounds embedded in an external SWF loaded into the main SWF.
    It's easy to control them when embedded on the main swf. However, on an externally loaded SWR, I get all kinds of errors. For this app, I really need to embed them in the external SWF.
    I read several solutions, but none seem to work.
    I embed the sound an mp3 file called soundSegment1.mp3 using Flash CS6 import tool and then open the actionscript properties panel on flash to select the class name: SoundSegment1. Then I edit the class code and create a file called SoundSegment1.as and it's saved right next to my document class main.as in the same directory. The code of the SoundSegment1 class looks like this:
    package  {
        import flash.media.*;
        public class SoundSegment1 extends Sound
            public function SoundSegment1 ()
                // no code in here
            public function playSound()
                var soundSegment1:Sound = new SoundSegment1();
                var channel:SoundChannel = soundSegment1.play();
    Then, in my main.as, I have done several attempts to play this sound such as:
    var fileLocation:URLRequest = new URLRequest(SWFToLoad); loader.load(fileLocation); loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeListener); loader.contentLoaderInfo.addEventListener(Event.INIT, initListener); 
    function initListener(e:Event):void // I also placed this code on the completeListener and it didn't work {      loader.content.soundSegment1.playSound(); // doesn't work.  }
    I get:
    Line XXX 1061: Call to a possibly undefined method playSound through a reference with static type flash.display:DisplayObject.
    or, I also read that I should be able to do something like this anywhere in the Main.as file:
    var theClass:Class = Class(loader.content.getDefinitionByName("SoundSegment1")); var theSound:theClass = new theClass(); theSound.play()  //doesn't work either.
    I also tried on the completeListener:
    var TheClass:Class = e.target.applicationDomain.getDefinition("SoundSegment1") as Class; var theSound:TheClass = new TheClass();
    theSound.play()  //doesn't work either.
    I get:
    ReferenceError: Error #1065: Variable SoundSegment1 is not defined. at flash.system::ApplicationDomain/getDefinition()
    I am stuck and I really need to get this to work. I would be genuinely grateful for your help.
    Thank you in advance for any help provided. I really need to get it to work, because I can't simply embed them in the main SWF or load them individually externally one by one.
    Thanks again!

    THANK YOU!
    I think your code may be over my head though. I think you are using an anonymous function which is not something I am familiar with (but I want to learn about if it's useful).
    I also don't know where the classS came from. I see that it's a parameter sent along with the event, but I don't really see where that came from.
    Someone at: http://www.kirupa.com/forum/showthread.php?305098-Playing-a-embedded-sound-in-an-external- swf&p=2658098#post2658098
    Is showing what seems to be an easier solution, but my problem there is I can't access the source file of the "child" swf....  ayayay.....
    I am going to tinker with your solution and see if it gets me anywhere. Thanks so much for your help again.

  • Loading library movie symbol from external swf

    Hi, I have a Flex/Air Application and I want this application
    to load in an external SWF and display a particular asset from the
    SWF library (just like attachMovie in AS2). I dont want to embed
    the SWF into the Air application. For the life of me I can't find
    any tangible info on how to do this. My second problem is that the
    assets sit in an SWF published for AS2 (is that an issue?). All
    content resides locally.
    Can anyone help or point me in the right direction?

    I see now how to import and display a library class object
    using:
    var MovieClipClass:Class =
    Class(loader.contentLoaderInfo.applicationDomain.getDefinition("myLibraryAsset"))
    var movieClip:Sprite = new MovieClipClass();
    addChild(movieClip)
    But this seems to only work for SWF's published for AS3 Flash
    Player 9.
    I need to do the same for SWF's published with AS2 Flash
    Player 7.
    Any ideas?

  • Xcelsius SWF with QaaWS through SSL: Cannot access external data

    I am getting the following error while loading Xcelsius Dashboard in https mode.
    Error: Error #2170, Cannot Access External Data
    Connection Type: Query as a Web Service
    To access external data, add a cross-domain policy file to the external data web server.
    The same dashboard is working on the following conditions:
    1)     In http mode(both from a hosted website and from a clarity portlet)
    2)     When I click preview from Xcelsius designer.
    3)     When I run the .swf file directly.
    The error is coming only when I host the swf file into a website (or running from a clarity portlet).
    I am using the following cross-domain-policy file.
    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
    <cross-domain-policy>
         <site-control permitted-cross-domain-policies="all"/>
            <allow-http-request-headers-from domain="" headers="" secure="true" />
            <allow-access-from domain="*" secure="true" />
    </cross-domain-policy>
    Any comments will be appreciated here.
    Thanks,

    Hi
    I am facing the #2032 Error while running the Dashboard in portal developed using SAP Netweaver BW connection.
    Scenario:
      1>Actually our dashboard changes as fiscal year or budget type changes,so we have set trigger for the queries.
      2>for 3-4 trigger times the dashboard changes as required without any error but after that when we change fiscal year or budget type it shows the following error:
    Error:"Cannot Access External Data"
    { The BICS Remote web Service could not process your request.Open a CSN message on component BW-BEX-ET-XC and attach the technical details of the error from the following link:
    http://sgsgsav0s2006:5000/bicsremotedebug?geterrorticket=KSF-1324043982210(this link changes each time the error pops up}
    This error will popup and then the dashboard randomly displays data for some queries and for some it does not pull data.
    After reloading the dashboard it runs fine for 3-4 times after that it again shows the error.This happens for 4-5 times then dashboard stucks at Initializing Screen for 10 mins then #2032 error comes.Then we restart our developement portal and the Dashboard runs fine for some time.
    This happens even while triggering 4 queries.
    We have
       Xcelsius 2008 Sp3
       Flash Player 10
       SAP EHP 1 for SAP NetWeaver 7.0
       SAP_BW sp08
       SAP_ABA sp08
       SAP_BASIS sp08
    Dont know how to check Java Stack Version.
    Please reply soon,so that we can proceed.
    Thanks
    Edited by: chinmaypadhi on Dec 29, 2011 7:44 AM

  • Access a component inside external swf file

    Hi, I loaded a external swf file that it is a dialog.
    var swfLoader : Loader = new Loader();
    var swfURL : URLRequest = new URLRequest("dialog.swf");
    swfLoader.load(swfURL);
    swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,imgLoaded);
    function imgLoaded(event:Event):void
    var movie : * = swfLoader.content;
    var clip : MovieClip = movie;
    parent.addChild(clip);
    Now, inside the movieClip there is a TextField component
    named message that i want to change its 'text' property.
    The question is: How can i access to this property to change
    it?
    Regards

    okay,
    I have the image component in ProductCatalogThumbnail.mxml, which has an id of "img"
    so, i created a public variable in the file and a public function that returns the value of the object.
    public var imagecopy:Object;
            [Bindable]
             public function imagecopyfunction():Object{
             imagecopy  = img;
             return imagecopy;
    now, I want to access this image in the mxml file ProductList.mxml in a function
      public function init():void
          ProductCatalogThumbnail.imagecopy.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
         // accepting a drag/drop operation...
           this.area.addEventListener( DragEvent.DRAG_ENTER, acceptDrop );
           // handling the drop...
          //this.area.addEventListener( DragEvent.DRAG_DROP, handleDrop );
    I tried to use the variable, and then i tried to use the function:
    I got this error when I tried the variable : 1119: Access of possibly undefined property imagecopy through a reference with static type Class.
    ProductCatalogThumbnail.imagecopy.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
    and this error when i tried the function:  1061: Call to a possibly undefined method imagecopyfunction through a reference with static type Class.
    ProductCatalogThumbnail.imagecopyfunction().addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
    i made sure i imported ProductCatalogThumbnail file in the beginning of my application.
    I am not sure what went wrong.

  • Loading from library conflicts with loading external swf

    I'm very new to ActionScript, so this might be incredibly basic. However, I've Googled and read myself into a coma and I'm not finding a solution.
    I have a movie with 6 navigation buttons.  Four of them load external .swf slideshows, and they work fine - as each file loads, the previous one clears the stage, etc.  The other button that I currently have set up is loading, from the library, an image.  The problem I'm having is that the slideshows replace each other on the stage - they're not stacking, they're replacing - but when the user selects the button that loads the image, the image overlays the last-selected slideshow.  If the user selects the image first, the image is visible when two of the external files transition.  Because of that 6th button, which is not yet even started, it's not desirable to me to simply set up the single image as another external file; if it's at all possible, I need to be able to pull from a library file when I build that last button.
    What I'd like to do - because there is no logical order that the buttons should be selected in - is figure out how to tell every button to remove the image file on click.  I've tried using this in the four buttons that link to the slideshows, to deal with the image (that's the one called quoteImage):
         if(myLoader != null && contains(quoteImage)){
            myLoader.removeChild(quoteImage);
    which has the advantage of not giving me any errors, but doesn't actually fix my problem.  I've tried many, many other things, and I'm just really stumped on what exactly I need to do to make this work the way I want it to.  Based on the fact that the books and online resources I've been using don't really cover this specific example, I suspect it might be an incredibly idiot thing to do, but I'd really like it to work this way if that's possible.
    The code as it stands, with the global variables and the first two buttons (the next three are identical to the second button and the sixth button doesn't exist) looks like this:
    var myLoader:Loader=new Loader(); 
    var quoteImage:Bitmap;
    stop();
    // Loads quoteImage from library
    btnQuotes.addEventListener(MouseEvent.CLICK, showquote);
    function showquote(event:MouseEvent):void {
    var myBitmapDataObject:myBitmapData = new myBitmapData(500, 350);
    var quoteImage:Bitmap = new Bitmap(myBitmapDataObject);
    quoteImage.x=150;
    quoteImage.y=180;
    addChild(quoteImage);
    // Loads industrial.swf from external file
    btnIndustrial.addEventListener(MouseEvent.CLICK, showindustrialcontent);
    function showindustrialcontent(event:MouseEvent):void {
    var myURL:URLRequest=new URLRequest("industrial.swf");
    myLoader.x=150;
    myLoader.y=180;
    myLoader.load(myURL);
    addChild(myLoader);
    Help is very much appreciated.

    I see now how to import and display a library class object
    using:
    var MovieClipClass:Class =
    Class(loader.contentLoaderInfo.applicationDomain.getDefinition("myLibraryAsset"))
    var movieClip:Sprite = new MovieClipClass();
    addChild(movieClip)
    But this seems to only work for SWF's published for AS3 Flash
    Player 9.
    I need to do the same for SWF's published with AS2 Flash
    Player 7.
    Any ideas?

  • Loading external SWF fila and accessing variables/functions

    Hello everybody!
    My first post here. Actually I do search google for answers all the time, but now - it's tough one.
    public function loadScreen(swf:File):void {
         _content = swf;
         var swfBytes:ByteArray = new ByteArray();
         var file:File = _content;  
         var loadStream:FileStream = new FileStream();
              loadStream.open( file, FileMode.READ );
              loadStream.readBytes( swfBytes );
              loadStream.close();
         var loader:Loader = new Loader();
         var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
              loaderContext.allowLoadBytesCodeExecution = true;
              loader.loadBytes( swfBytes, loaderContext);
              loader.contentLoaderInfo.addEventListener(Event.INIT, accessSWF);
              loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
    public function errorHandler(e:Event):void {
         trace("PROBLEM LOADING BYTES");
    public function accessSWF(e:Event):void {
         var moduleLoader:LoaderInfo = LoaderInfo(e.target);
         moduleLoader.content.addEventListener(Event.INIT, readyHandler);
    public function readyHandler(e:Event):void {
         _initOptions = new NativeWindowInitOptions();
         with(_initOptions) {
              resizable = true;
              transparent = false;
         var boundsWin:Rectangle = new Rectangle(100, 100, 423, 430);
         _window = new NativeWindow(_initOptions);
         with(_window) {
              activate();
              bounds = boundsWin;
              stage.scaleMode = "noScale";
    The problem is that application loads the external swf with loadBytes, but it's not executing the script. Actually, I'm not able to use the loaded swf. I'm not able even to add it to Stage. But message in output still shows, that the swf file is loaded "[SWF] file.swf/[[DYNAMIC]]/1 - 2746 bytes after decompression"
    There are many solutions for this problem on the internet, but they're old (written in 2008 most of all) and not working either, because those solutions work only in older AIR versions
    Any help?

    Well I got a bit further:
    public function loadScreen(swf:File):void {
         var loadStream:FileStream = new FileStream();
         with(loadStream) {
              openAsync( swf, FileMode.READ );
              addEventListener(ProgressEvent.PROGRESS, loadProgress);
              addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
              addEventListener(Event.COMPLETE, loadComplete);
    public function loadProgress(e:ProgressEvent):void {
         trace("Loading " + e.target.bytesAvailable);
    public function errorHandler(e:IOErrorEvent):void {
         trace("Error ");
    public function loadComplete(e:Event):void {
         var swfBytes:ByteArray = new ByteArray();
         FileStream(e.target).readBytes( swfBytes );
         var loaderContext:LoaderContext = new LoaderContext();
         with(loaderContext) {
              allowLoadBytesCodeExecution = true;
         var loader:Loader = new Loader();
         with(loader) {
              loadBytes( swfBytes, loaderContext);
              contentLoaderInfo.addEventListener(Event.INIT, completedSWF);
    public function completedSWF(e:Event):void {
         var moduleLoader:LoaderInfo = LoaderInfo(e.target);
         moduleLoader.addEventListener(Event.COMPLETE, initiatedFinally);
    public function initiatedFinally(e:Event):void {
         _initOptions = new NativeWindowInitOptions();
         with(_initOptions) {
              resizable = true;
              transparent = false;
         var boundsWin:Rectangle = new Rectangle(100, 100, 423, 430);
         _window = new NativeWindow(_initOptions);
         with(_window) {
              activate();
              bounds = boundsWin;
              stage.scaleMode = "noScale";
         var loader:Loader = e.target.loader;
         loader.addEventListener(Event.ADDED_TO_STAGE, irAdded);
         _window.stage.addChild(loader);
    public function irAdded(e:Event):void {
         trace(e.target.content.vars); // Object Dictionary
    At this point ( function irAdded ) I'm able to retrieve external SWF's variables. But stil, it's not visible on the stage. And yet - there's another problem - rendering the same script , every second time application unloads the external swf movie.

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

Maybe you are looking for

  • How do I "Change country with this account" with a family share plan

    I have a family that is international. We have two accounts, one each in a different country! wife and I. Both accounts have many books, music apps and lots of iTunes credit still on account. . While trying to set up the new family plan, I keep getti

  • Maintenance order for Refurbishment

    Dear Experts, I have created a maintenance order for the equipment E12000003 with order type PM01 and using the control key PM03.Material 12000003 representing the equipment E12000003 issued against the PM order . Purchase requisition is created at t

  • Safari keep crashing after recently security update

    yesterday I had my mac updated with latest security update. right after the restart, safari keep crashing after launching about couple mins. is similar issue reported? is there any solution? here is the issue report: Process: Safari [1800] Path: /App

  • Install photoshop elements 11

    hi want want to install photoshopelements 11. but there is only one file to download, PhotoshopElements_11_LS15.7z Accordign to my data i need to have another file. does anyone know where i can download it?

  • How to maintain Gold Price

    Hi Please Help, Price of Gold is defined Universally so the price of gold keeps on changing daily. my question is how can i maintain the price of Gold?should we maintain it in material master or some other configuration?