Flex Application Interaction with load Flash SWF

Hi all

First of all, the context:

I'm creating a Flex application with a component that displays several SWF loaded dynamically, one at a time (a bit like a kiosk). These loaded SWF files is created in the Flash IDE, Flex No. They will not be created by us (we will provide a .fla but model it is), so I am loading them in a separate SecurityDomain.

My Questions:

  1. I want the application to be able to call methods inside the loaded SWF file. To do this, I would just call Security.allowDomain ("flex application domain") in the boot process for the loaded SWF file?

  2. I want the SWF loaded to throw events that are taken by the application. Can I achieve this through the SWFLoader.swfBridge (http://www.adobe.com/livedocs/flex/3/langref/mx/controls/SWFLoader.html#swfBridge) property?

  3. I'm defining an interface for methods inside the loaded SWF file. But I don't want to leave the implementation up to the customer. Instead, I want to provide another SWF that contains the implementation of the interface and have a constraint that the customer includes it in their SWF file. I'm not very familiar with the Flash programming environment, how would that work so that the SWF interface implementation exposes his methods so as to be accessible to the Flex? Is it possible to sign the SWF file so that the Flex application knows that it is dealing with the original, not a parody? How would the Flex code pass in arguments, since it is through SecurityDomain limit - is there marshaling involved (for example if I want to pass in a dictionary or some kind of object graph)?

  4. The Flex application can load hundreds of these small other sovereign wealth funds during his life. How can ensure me that it is not continue to use more memory? I intend using SWFLoader.unloadAndStop () and erase all references to the Flex object that refers to it. Is this enough? Will be the AppDomain for the loaded SWF file to tear down automatically so that the class definitions are no longer in memory?

Thank you

Knockaert

3 sounds good, but that's all theory.

I think that there are other ways to package code to Flash other than "components".  I think that there are some libraries of data/network, but I don't know how they are packed these days.

4. in theory, it will try to match fields that match and ignore those that do not fit as well.  With the help of readObject/writeObject should work, but you should be able to call the IExternalizable APIs directly.

Alex Harui

Flex SDK Developer

Adobe Systems Inc..

Blog: http://blogs.adobe.com/aharui

Tags: Flex

Similar Questions

  • AIR flash application can not load child SWF on publishes on device

    I have been struggling with this problem for WEEKS now and can not solve. I have a soft flash AIR (creative cloud, AIR 3.8) that is very simple: there is no that load external SWF movies on the click of a start button. It works FINE in test/PC but when I publish to the device, the external swf will not load.

    Here is the code on the main timeline that calls the external swf:

    Start button

    start_button_TRI_desmatosuchus.addEventListener (MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_02_3, false, 0, true);

    Import fl.display.ProLoader;

    import flash.events.Event;

    var fl_ProLoader_02: ProLoader;

    var fl_ToLoad_02:Boolean = true;

    function fl_ClickToLoadUnloadSWF_02_3(event:MouseEvent):void

    {

    If (fl_ToLoad_02)

    {

    fl_ProLoader_02 = new ProLoader();

    fl_ProLoader_02.load (new URLRequest("dinofilms/triassic_desmatosuchus.swf"));

    fl_ProLoader_02.contentLoaderInfo.addEventListener (Event.COMPLETE, onComplete_02)

    addChild (fl_ProLoader_02);

    fl_ProLoader_02.x = 0;

    fl_ProLoader_02.y = 144;

    }

    on the other

    {

    If (fl_ProLoader_02! = null) {}

    removeChild (fl_ProLoader_02);

    fl_ProLoader_02.unloadAndStop ();

    fl_ProLoader_02 = null;

    }

    }

    fl_ToLoad_02 =! fl_ToLoad_02;

    }

    function onComplete_02(e:Event):void {}

    e.currentTarget.content.addEventListener (Event.ENTER_FRAME, OEF_02);

    }

    function OEF_02(e:Event):void {}

    If {(e.currentTarget.currentFrame is e.currentTarget.totalFrames)

    e.currentTarget.stop ();

    e.currentTarget.removeEventListener (Event.ENTER_FRAME, OEF_02);

    removeChild (fl_ProLoader_02);

    fl_ProLoader_02.unloadAndStop ();

    fl_ProLoader_02 = null;

    }

    }

    I called about 30 different movies to 30 different images, that's why I use words such as "proLoader_01" so I don't duplicate them. All external SWFs are of course in the files included too.

    I would really appreciate the help, I am a reluctant coder!

    Post edited by: Fiona Passantino

    Yes, this is important when you load SWF actionscript files to contain and you need only actionscript work and are something I alluded to message 9.

    It is not relevant to your problem, unless you have poorly explained the problem.  from your description, you do not see the loaded SWF files to load.  If the SWF load really smoothly, but they contain actionscript code that does not work, you must fix your problem description.

    ****************************************************************************************** *********

    Edit: the above is not correct.  you do need to declare a loadercontext when loading an external swf with the latest (3.6 +) SDK of air even if the external swf contain no actionscript.  Otherwise, the load() method (and any code appearing later) fails to run

    then, use something like:

    loader = new Loader();

    var lc:LoaderContext = new LoaderContext (false null, ApplicationDomain.currentDomain),

    Loader.Load (new URLRequest("dinofilms/cretaceous_ankylosaurus.swf"), lc);

  • Help with loading a swf from the Google Map API done in AS3 AS2 Flash site

    OK, maybe this can be done, I need to do everything in AS3, or it is a problem of the Google Map API.

    If someone could put me on the right track, I would be grateful.

    I created a Google Map API for Flash Add to my Web site.

    My site has been built using AS2 and the Google Map API was built using AS3

    My site Flash .swf works fine and the Google Map.swf, I created works very well.

    The problem is when I try and do not add the Google Map.swf on my website flash As2 will Google.swf no work.

    I'm trying just to eliminate the error.

    Is it because that...

    1. after having my site flash with AS2, I can't add a .swf with AS3

    2. I need to change the code...

    3. it has nothing to do with AS3, it's because this is a Google Map API.


    I have a button written in AS2 on my main flash site that has a a PreLoader.


    on (release) {}

    Stop behavior MovieClip
    this.gotoAndStop ("Google_Map");
    End behavior


    load film behavior
    If (this.mcContentHolder is {Number (this.mcContentHolder))}
    loadMovieNum ("PreLoaderGoogle.swf", this.mcContentHolder);
    } else {}
    this.mcContentHolder.loadMovie ("PreLoaderGoogle.swf");
    }
    End behavior
    }

    The PreLoaderGoogle.swf was then has a

    Instance of: charger

    contentPath

    Google_Map.swf

    If I change the Google_Map.swf instance in the PreLoader for an another .swf using AS2 it all works.


    or do I just have the wrong end of the stick.

    All advice appreciated.

    If you load an as3 swf into an as2 swf, none of the code in the as3 swf file will work.

    the simplest way around this is: you could create a loader swf (GER) as3 that loads your as2 swf and load your google as3 swf.

  • Problem with loading external swf files

    Hello

    I am currently working on a project which is an interactive and dynamic elemtry school presentation to the Denmark. I finished my project and it works perfectly, but only locally on my computer.

    The final draft should be implemented on the site and public work. I tried to implement the project on the site and unfortunately, it does not work as expected.

    When all the files where transferred to the ftp server, only a single files are responding and appear correctly.

    Interactivity of the project is based on a structure of Action script, which is based on the smooth transition between swf files (load another swf file after the action is triggered by clicking on a button) do any work.

    After days of trying to figure out the solution, I'm totally lost. One thing is to publish the project so that all action script will work and answer between swf files, and the other thing is to make it user-friendly for the Android and apple products.

    The presentation is quite heavy because of its loading external swf content files, which are images and movies.

    I really hope you can help me with my problem. I will gladly share the files and codes if it would help solve the problem.

    Best regards

    Agata

    It could be a problem of location of file from loading.  When you place a swf file in an HTML base for targeting anything that the SWF load becomes the folder of the html page.  You may need to adjust the target so that the target of swf files, load it as if it were in the same folder as the html page.

  • FlexUnit4 with Flex Application compiled with Flex SDK 3.0?

    The Flex application that I work on is compiled with Flex SDK 3.0.

    Now I want to unit test this application using FlexUnit4.

    I'm not able to find that flexunit4 for Flex SDK 3.0 in downloads page (http://www.flexunit.org/?page_id=14).

    So I decided to download the FlexUnit 4 source code and compile it using the Flex SDK 3.0.

    I downloaded the source code of the page of downloads (http://github.com/flexunit/flexunit/).

    I need help in the compilation of the projects. I want to know what are the configuration changes that I need to run the build.xml ant task in my local machine.

    Please help me out here.

    @crazyghost81 - http://opensource.adobe.com/wiki/display/flexunit/Get+Source+Code

  • need help with loading Flash on Apple Mac Mini

    Lost my username, password & I am unable to load flash version 8 or better, totally computer illiterate & need HELP!

    Hi Michael,

    Please see what userid & password I need to install Flash Player?.

    --

    Maria

  • Flex application on URLLoader.load)

    Hi all

    I'm starting to learn flex/actionscript. I developed a simple flex project to experiment with URLLoader.load () and used trace() to get the order in which the methods are called. I did not understand the order in which the results of the trace are displayed. My code is:

    package LoadPack
    {
    import flash.events.Event;
    import flash.events.IOErrorEvent;
    import flash.net.URLLoader;
    import flash.net.URLRequest;

    Import mx.controls.Alert;

    public class ApplInfo
    {
    private static var instance: ApplInfo = null;
    private var applInfoXML:XML = new XML();
    private var serverForAppl:String = "DataAccessLocalApplServer";
    private var applContextRoot:String = "DataAccessLocalApplContextRoot";

    private var selectedServer:String ="";
    private var selectedServerContextRoot:String ="";
    private var selectedServerLabel:String ="";
    private var selectedServerContextRootLabel:String ="";

    Public Shared function getInstance (): {ApplInfo}
    if(instance == null) {}
    trace ("ApplInfo instance is null");
    instance = new ApplInfo();
    trace ("ApplInfo instance created");
    }
    return instance;
    }

    public void ApplInfo()
    {
    trace ("inside the constructor of ApplInfo");
    getApplProperties();
    trace ("selectedServer... getApplProperties->" + this.selectedServer);
    trace ("selectedServerContextRoot... getApplProperties->" + this.selectedServerContextRoot);
    }

    private function getApplProperties (): void {}
    trace ("inside getApplProperties");
    var applXML:String = ' assets/ApplInfo.xml ";
    var urlReq:URLRequest = new URLRequest (applXML);
    var urlLdr:URLLoader = new URLLoader();
    urlLdr.addEventListener (Event.COMPLETE, doOnComplete);
    urlLdr.addEventListener (IOErrorEvent.IO_ERROR, doOnError);
    trace ("prior to loading");
    urlLdr.load (urlReq);
    trace ("after");
    }

    private void doOnError(evt:Event):void {}
    Alert.Show (evt. ToString());
    }


    private void doOnComplete(evt:Event):void {}
    trace ("inside doOnComplete");
    var urlLdr: URLLoader = evt.currentTarget as URLLoader;
    applInfoXML = new XML (urlLdr.data);
    for each {(var serverXML:XML in applInfoXML.application.servers.server)
    if(serverXML.@type == serverForAppl) {}
    this.selectedServer = serverXML.text ();
    this.selectedServerLabel = serverXML.@label;
    }
    }
    for each {(var contextRootXML:XML in applInfoXML.application.contextroots.contextroot)
    if(contextRootXML.@type == applContextRoot) {}
    this.selectedServerContextRoot = contextRootXML.text ();
    this.selectedServerContextRootLabel = contextRootXML.@label;
    }
    }
    trace ("selectedServer... doOnComplete->" + this.selectedServer);
    trace ("selectedServerContextRoot... doOnComplete->" + this.selectedServerContextRoot);
    }

    public function getApplURL (): String {}
    trace ("selectedServer... getApplURL->" + this.selectedServer);
    trace ("selectedServerContextRoot... getApplURL->" + this.selectedServerContextRoot);
    Return this.selectedServer + this.selectedServerContextRoot;
    }

    }
    }

    I call this AS from another class like class

    ApplInfo.getInstance () .getApplURL ();


    and I get the following trace output.

    ApplInfo instance is null
    inside ApplInfo constructor
    inside the getApplProperties
    Before load
    after charge

    selectedServer... getApplProperties->
    selectedServerContextRoot... getApplProperties->
    ApplInfo created instance
    selectedServer... getApplURL->
    selectedServerContextRoot... getApplURL->
    inside the doOnComplete
    selectedServer... doOnComplete-> http://localhost:8090
    selectedServerContextRoot... doOnComplete-> /DataAccessProj


    My understanding is that once load finishes its operation, for Event.complete handler will run and in my case, the doOnComplete(evt:Event) method must be performed. After that, only the code, proceed to subsequent statements. But the trace output doesn't look like that.  I will be missing something seriously, but could not know.   I already spent a day on it. I also enclose the project. Help, please...

    Load() is asynchronous and does not block to the right of the line after it works immediately in the meantime the network address

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc..

    Blog: http://blogs.adobe.com/aharui

  • Help please! Problems with loading external swf files

    I'm scared, I'm new to both Adobe Flash and Actionscript 3.0.

    I'm trying to create a simple site using a couple of different external sovereigns loaded into a main swf file.

    For the moment, in the timeline panel, I have the following code in frame 1 of the layer actions:

    import flash.events.MouseEvent;

    Stop();

    navbutt.addEventListener (MouseEvent.CLICK, shownavbg);
    function shownavbg (myEvent:MouseEvent): void {}
    gotoAndPlay (10);
    }
    home_btn.addEventListener (MouseEvent.CLICK, showhome);
    function showhome (myEvent:MouseEvent): void {}
    gotoAndPlay (66);
    }
    aboutme_btn.addEventListener (MouseEvent.CLICK, showaboutme);
    function showaboutme (myEvent:MouseEvent): void {}
    gotoAndPlay (49);
    }
    gallery_btn.addEventListener (MouseEvent.CLICK, showgallery);
    function showgallery (myEvent:MouseEvent): void {}
    gotoAndPlay (76);
    }

    var bgLoader:Loader = new Loader();
    stage.addChild (bgLoader);
    ("var url: URLRequest = new URLRequest("Background/sitebackground/Main.swf ");
    bgLoader.load (url);
    stage.setChildIndex (bgLoader, 0);

    Then, in the framework of 76, I have the following code:

    removeChildAt (0);
    bgLoader.unload ();

    In section 77:

    var galleryLoader:Loader = new Loader();
    stage.addChild (galleryLoader);
    var galleryurl:URLRequest = new URLRequest("test/ZenGalleryDemo.swf");
    galleryLoader.load (url);
    stage.setChildIndex (galleryLoader, 0);

    Stop();

    The idea is that, when the file is loaded, the 'sitebackground/Main.swf"flash loads on the stage. Then I want to delete this flash and load a different one when I click on the gallery_btn. So, when I click on the gallery_btn, he plays frame 76, theoretically unloading the Main.swf and the loading of the ZenGalleryDemo.swf in its place.

    For the moment, the Main.swf loads perfectly and works great. But when I click on the button to the Gallery, he jumps to the frame 76 and plays the Main.swf. It does not load the file ZenGalleryDemo.swf...

    If anyone has any ideas, I would be really grateful!

    Thanks in advance

    It's just a glance and reading, but the problem may lie between these two lines... look closely...

    var galleryurl:URLRequest = new URLRequest("test/ZenGalleryDemo.swf");
    galleryLoader.load (url);

  • Flex 4 Embed fonts in flash swf VS embedding fonts in Adobe flex

    I have this dilemma... What is the best way to embed fonts?

    In flash, I can easily integrate fonts + strings of characters that I need the menu, export the swf file and then use it in flex.

    I don't see an easy way to define the character ranges in flex. How can I get the values that I need? I read that the format is U + (beginning of range)-(end of range) but where I take beginning and end of the beach of?

    Thanks in advance.

    Search for the file "flash-unicode - table.xml" in your Flex SDK installation folder (he sits next to 'flex-config' file)

    "Flash-unicode - table.xml" contains various language of the character ranges that you can find convenient.

    More on this can be read here http://frankieloscavio.blogspot.com/2008/01/flex-embedded-fonts-more-control-over.html

  • Problem with loading/unloading SWFs external

    Hey! Thank you in advance for any assistance you can provide. Here's the question: my master I am loading an external swf file. This file overlays the original file, so I started looking for a way to download the original file. I was not very successful. I've looked through these forums and did research on google, too, but found only a partial solution.  Right now, I have created a background layer that allows the loaded file cover the original file without bleed through.  I'd rather have the original file unload before loading the file newly appointed.

    Here is the code that I found so far:

    Declaring Variables
    var Xpos = 0;
    var Ypos = 0;
    var loader: Loader = new Loader();
    var swfFileToLoad: URLRequest = new URLRequest ("holdHumans.swf");

    Go to the creation
    removeChild (loader);
    Loader.Load (swfFileToLoad);
    Loader.x = Xpos;
    Loader.y = Ypos;
    addChild (loader);

    This code is normally associated with a key event, but I have to be able to use it inside a timer function in the original file. When the function is called, I get this message: Error #2025: the supplied DisplayObject must be a child of the caller.

    I get this message too when I try to use it in the swf file loaded externally.

    How to solve this problem?

    Thank you

    Michael

    You are welcome.

  • Tool to watch how an application interacts with the OS network stack?

    I have a third-party commercial application that sends a UDP broadcast and waits for a response from machines on the same network.  It works fine when only one card NETWORK interface (we'll call it "primary") is enabled but if I enable the 'secondary' adapters fails.  It seems that the problem is in how the application is to determine what NETWORK card to use.  Y at - it a tool that would let me ask questions or look at what made the app to determine what NETWORK card to send traffic on?  I took the Wireshark traces and that showed me the traffic but I need something that will give me more information at an earlier stage of the process.  I also watched some of the Sysinternal tools and wasn't sure if one of those who do the trick.  Looks like I need to look at the app launch and watch it somehow to go through the process of selecting an interface to use.  Is this possible?

    OS is WinXP and/or Win2008 32 or 64-bit.

    Hello

    I recommend you post the question in the Windows Server Forums.

    http://social.technet.Microsoft.com/forums/en/category/WindowsServer

    Thanks and greetings
    Umesh P - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.
    [If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message.] [Marking a post as answer, or relatively useful, you help others find the answer more quickly.]

  • Why can I not see this non-local flex application?

    I'm a CF developer and playing with Flex for the first time. I find it very strange problem. For example: I just made my first file in the demo and I can see very well on the server where I did (yah - I had to do on the server - Flex refuses to install on my desktop, but that's another story) but I can't see it from a distance. Yes, I have Flash 9 installed and work.
    Try you it: you see something else than a white pea green here: http://www.poststat.net/traffic/demo/bin/demo.html ? Source code seems fine. If I swap in a former SWF that carrying on, I got, it loads it very well. If I try to simply load the SWF here (demo.swf) it does the same thing: green white screen.
    That is what it is?
    Please give me some ideas.
    Thank you very much
    Maya

    In fact, you need not additional files. Just the SWF is fine or the html file too if you are the points.

    The question was: a 9,0,0, x version of Flash Player! I had something like 9,0,0,296. The worst was the only way to upgrade to the latest player (9,0,16, x) had to manually reboot then UNINSTALL (requires download of the uninstall program), and then reinstall the latest version.

    So if you see an empty flex application, click on about Flash 9 and verify what version of Flash you have. 9,0,0, x those who seem to be wacky.

  • Loading a swf into an AS2 clip file

    I had some problems with loading a swf into a clip.  The code I use is as follows

    {We (Release)}
    contentbox.loadMovie("contact.swf",0);
    }

    It works fine on the loading plan, but it loads the swf file so that the upper left corner is at the center of the content area, pushing the bottom and the right side of the way of content off the screen.

    Looks like the contentbox registration mark is centered.

  • Error when loading a swf file created in flash cs4, inside a flex application

    Hello

    I created a rotating logo in flash cs4 using motion presets, named logoRotar.swf. I've used this within my flex application:

    "< mx:SWFLoader width="33.33% "height ="100% "source =" assets/logoRotar.swf ">

    When I run the flex application, I get this error message:

    VerifyError: Error #1014: class flash. geom::Matrix3D is not found.

    Global $init)
    at fl.motion::AnimatorFactory3D/getNewAnimator()
    at fl.motion::AnimatorFactoryBase/addTargetInfo()
    at logoRotar_fla::MainTimeline()

    I also tried to add import flash.geom. *; statement in my flex application, I always get the same message.

    Flash player 10,0,22,87 is underway in my browser.

    Please help me...

    See you soon!

    Deepak

    Download Flex 3.3 and use-target-Player = 10

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc..

    Blog: http://blogs.adobe.com/aharui

  • Pause the captivate swf while incorporated a swf flash is interacted with

    Hello world.  For reasons too complex to enter, I need to embed a quiz done in Flash, in Captivate.  This, I got, my only problem is that, because the game requires user interaction, I need the film Captivate to stop playing until they got the correct quiz!

    I understand that I can put an area of Captivate click or button on the timeline of Captivate, but which would allow the user to jump in front of the quiz, and as it is e-Learning, which is not an option.

    Is there an actionscript that I can put in the Flash quiz that allows to control the container Captivate movie?

    Thanks in advance!

    Hi Susan,.

    Variables work in CP2 and the NextSlide should certainly work. You use a skin/playback bar in your Captivate project? If so, then the path to the file, Captivate swf receiving instruction is different.

    If you use a skin test to send the Flash command like this: _parent._parent._parent.rdcmndNextSlide = 1;

    CP variables can be used to control the Captivate swf in many ways. You could use a Flash shell as a container for your Captivate swf and then use variables to manage navigation and other aspects. You can also import a Flash file in Captivate and have this file to communicate with the Captivate swf.

    / Michael

    Click here to visit the blog of www.captivate4.com

Maybe you are looking for