Communication from a flex app. to a swf loaded inside it at runtime

I am loading a swf (made with Flex 2) inside another flex
application using the SWFLoader as:
<mx:SWFLoader id="swfLoader1" source="Modules.swf"
width="100%" height="100%"/>
the swf ("Modules.swf' ) loads as expected, but form the
parent movie I want to be able to control (change values of
variables) parameters on the child swf (swfLoader1).
When a click a button in the host movie I want to change the
text on a label on the child movie, but it is not working for me.
I have done this:
when clicking the button call a function doStuff()
public function doStuff():void
var myMovie:* = swfLoader1.content;
myMovie.mod1_desc.text = "blah blah";
But it's not working. Then I tried
public function init():void
_loader = new Loader;
extContent.addChild(_loader);
_loader.contentLoaderInfo.addEventListener(Event.INIT,
doStuff);
_loader.load(new URLRequest("Modules.swf"));
init() is called from creationComplete on the Application
(MXML) and when the _loadr is loaded it calls the doStuff function
above. Again is not working.
Any suggestions on how to do this right?
Gilbert

Probably not.  Otherwise lots of great malware would be delivered via Flash.

Similar Messages

  • Sending JSON from a Flex app?

    I have a bunch of data in my app I need to send to a back-end developer.  It's a series of string and arrays,.  The developer wants in sent as a JSON object.
    Can I construct one from my Flex app, and how would I get it to the server?  Can anyone point me to any examples or documentation on this?
    I have consumed JSON in the past, but never sent it.
    Thanks.

    "... limit the .swf file to be run within a web page..", Yes,
    but why is this a problem? It is the normal way to deliver a Flex
    app.
    The only other way is to use server-side functionality to
    send the mail.
    Tracy

  • Draw a rectangle from a flex app

    Hello,
    GRAND CHALLENGE (should be "hello world" that anyone should
    easily find):
    1) - a flex app with a button
    2) - when clicked the button draw the rectangle
    PROPOSED NON WORKING SOLUTION:
    draw.mxml:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>import DrawApp;</mx:Script>
    <mx:Script>
    <![CDATA[
    function drawNow():void{
    var myRectangle:DrawApp = new DrawApp();
    myCanvas.addChild(myRectangle.returnRectangle());
    ]]>
    </mx:Script>
    <mx:Canvas width="100%" height="100%"
    id="myCanvas"></mx:Canvas>
    <mx:Button label="draw"
    click="drawNow()"></mx:Button>
    </mx:Application>
    DrawApp.as:
    // ActionScript file
    package {
    import flash.display.*;
    class DrawApp extends Sprite
    public function DrawApp()
    //don't use the constructor anymore since it won't return
    the rectangle
    public function returnRectangle():Shape
    var rectAndCircle:Shape=new Shape();
    rectAndCircle.graphics.lineStyle(1);
    rectAndCircle.graphics.beginFill(0x0000FF,1);
    rectAndCircle.graphics.drawRect(125,0,550,575);
    rectAndCircle.graphics.endFill();
    return rectAndCircle;
    }//class
    }//package
    I've got an error "1034" (BTW as a bonus if anyone know how i
    can avoid to have the localized AS3 error messages so I can paste
    full error messages in English)
    CHALLENGE:
    Can someone show me how to make this wok before Silverlight2
    Beta get out?
    Thanks from francois who's mad trying to solve this "should
    be obvious hello world" for too long and who also discovered
    lately:
    - the lack of threads in AS3
    - the insane security policy around Flash Player (must
    install a proxy to access a public API...)
    - etc.
    Help please Oo

    Ok found the solution: needed to change the "Shape" object by
    a "UIComponent" object (don't know why).

  • Run out other tools directly from a Flex app

    Hi all.
    I develop a flex app and I want to integrate it with another tool.
    More specifically, I would like to click a button at my interface, and automatic and transparently to the user, a file with name and address pre-defined be written at the HD (without to use the FileReference object) and after, that an interpreter automatically run this file.
    I had saw this is possible with the AIR technology, but the web nature of my project doesn't allow me a platform change.
    So, I woudl like to ask you if my demand could be accomplished using the flex technology.
    Thanks in advance,
    Péricles

    Probably not.  Otherwise lots of great malware would be delivered via Flash.

  • AS2 SWF loaded inside a AS3 SWF

    Hi,
    In a recent project I had to load a FlashPaper2 document
    inside a SWF implemented in AS3. I read a couple of articles about
    Darron
    Shcall's article and
    FlashInterface
    but none of them seemed to be useful in my case.
    I needed to load a FlashPaper SWF inside a AS3 and couldn't
    rely on ExternalInterface since they were not two separate SWF's.
    To be more clear, I was using the Loader class via a Sprite to load
    the FlashPaper SWF.
    Anyways, I created FlashPaperLoader.SWF implemented in AS2
    which was used to load the FlashPaper SWF. This loader was able to
    communicate with the FlashPaper APIs (AS2). As you can guess, the
    AS3 SWF was used to load the FlashPaperLoader.swf.
    What I don't understand is how come the FlashPaperLoader the
    FlashPaper document SWFs can communicate with each other thru AS2
    function calls when they are loaded inside a AS3 SWF, I thought
    that due to VM differences, no communication is possible!
    I hope I was clear, if I was, any guru insight is really
    appreciated.
    Cheers.

    Thanks kglad,
    But you still haven't answered my question. I am not looking
    for solutions, my own solution works. I wanted to understand more
    about the VM's.
    AS3
    var request:URLRequest = new
    URLRequest("./FlashPaperLoader.swf");
    var loader:Loader = new Loader();
    loader.load(request);
    AS2
    var loader:MovieClipLoader = new MovieClipLoader();
    loader.loadClip("./FlashPaperDoc.swf", fpContainer);
    // the loader SWF used IFlashPaper APIs to communicate with
    the FlashPaper SWF.
    Now, the first part (AS3), all that code is interpreted by
    VM2. Once an AS2 SWF is loaded a
    AVM1Movie
    is created and no direct communication between AS3 and AS2 is
    possible. I am curious to know how come the two AS2 SWFs can
    communicate with each other while inside the VM2 space.

  • Can I remove the startup progress bar from a Flex app?

    Hey all,
    I have built a few charts for my companies' website: http://www.midwestmarket.org/page/Area+Control+Error
    On all of them, I have noticed that there's a delay of 3 or 4 seconds from the time the page loads, a progress bar shows, and then the graph is actually shown.
    The charts in question are all Flex 3 builder built, and I am upgrading now to Flash 4 builder. But, still I see the progress bars.
    I know that Fusion Charts doesn't have this same startup routine, those charts pop right up as soon as the site is loaded. Now Fusion is of course build to JUST be a chart tool and probably doesn't load as much stuff. But, is it possible to get there with Flash 4 builder?

    hi,
    With flashbuilder you first need to load the swf, then it creates the display objects this is what the loadbar is there for, if you have embedded assets then that bar will stay even longer. Once the application creation sequence is complete the displaybar disappears and then your application is displayed.
    Now imagine removing that bar, on a slow connection with a 'large' app, the user would be faced with a blank screen for several seconds, not the desired end-user experience we are after.
    You can make it more interesting by customising the pre-loader with say a company splash screen which offers a more visually appealling startup
    this is a simple example of a custom preloader, source is included
    http://flashhub.net/ezflex/testloader/
    One quick note with preloaders there is no flex sdk at that point so preloaders have to comply with the immediate requirements of the flashplayer api. So basically on flash components.
    David.

  • Problems calling context-sensitive AIRHelp from Adobe Flex App

    Hi everyone...
    I´m having problems calling context-sesitive AIRHelp from Flex.
    I can launch the help from flex using the following code (flex), but allways starts on the default topic.
    private function invocarAirHelp(tema:String):void {
          var appID:String = "pc1";
          var pubID:String = "8C47FDE4638CAF7F210634E52A5F8318D893A57C.1";
          var mgr:ProductManager = new ProductManager("airappinstaller");               
          mgr.launch("-launch " + appID + " " + pubID);
    the launch method can recive parameters after the publisherID, but i dont know the parameters that i should give to the method to start the AIRHelp on an specific topic.
    I tryed using the parameters as the call was on the command line, ex:
      mgr.launch("-launch " + appID + " " + pubID + " -csh mapnumber 12");
    but i can get any results... with those parameters the help application doesn´t even start
    Anyone have an idea to make this works?
    Thanks in advance, Sabin

    Hi Sabin,
    The only supported way to launch AIR applications from the browser is the air "browser API": http://livedocs.adobe.com/flex/3/html/help.html?content=distributing_apps_3.html#1035834
    The browser API uses ProductManager internally and exposes higher-level browser API so that we change the implementation if necessary someday. The browser API will stay the same, even if the interactions through ProductManager (or something else) change.
    The browser API (air.swf) has other features that make it the preferred way to launch apps. For instance, it provides accurate information about which platforms support AIR, and can therefore manage install of new apps and of the runtime itself.
    Also, if the application is not installed then Browser API will return Error to the flex application, but that does not happen in case of ProductManager.
    That said, you can probably use "--" to separate arguments intended for airappinstaller from arguments that should be passed through to the app itself. 
    mgr.launch("-launch " + appID + " " + pubID + " -- -csh mapnumber 12");
    -Praful Jain

  • How to Call report from Adobe Flex App.

    Hello. We are trying to create a reporting solution for our Adobe Flex Applications. We use java and postgre. We also have Crystal Reports 2008 and run a lot of reports locally on end users machines. We have some reports we would like to call from flex and have execute in java and send a PDF back to the end user. So:
    1. Is it possible to do this with Crystal for Eclipse?
    2. If yes can we send values from flex to the filter fields in the report?
    3. Do we then connect the report diereclty to postrgre to get the data?
    RIght now I have a report running in eclipse connecting to postgre. Just trying to see if we are going down the right path. THanks.

    You can integrate your reports with operational workflows by embedding Adobe Flex
    (SWF) applications into your reports. Using Adobe Flex Builder, you can
    create any business-user UI that accesses report data and also integrates
    with external web services. Data in your report can be passed to the Flex
    application via Flashvars, making it easy to create flexible UI even when you
    don't have web-services access to your data. The Flex applications can do
    tasks like database write-back and can invoke operational workflows directly
    within Crystal Reports.
    Thanks,
    Tej

  • Launch URL from AIR (Flex) App

    Hi There,
    Is it possible to launch a window containing a foreign URL
    i.e. something that will launch cnn.com?
    My customer wants an AIR App that will take the user to their
    homepage..
    Thanks,

    Hi
    try navigateToURL()
    http://livedocs.adobe.com/flex/2/langref/flash/net/package.html#navigateToURL()
    A pretty simple browser can be built only by using mxml
    tags

  • Generate PDF from existing flex app

    Hi all,
    Is there a way that i can generate a pdf file based on the
    existing flex application? For example, if i have a VBox called
    "my_vbox" and it contains some child elements, so how can i simply
    create a pdf that contains all my_vbox's content?
    Currently i only have a dummy solution that to print the
    template and use Acrobat Professional to convert it, e.g.
    var printJob:FlexPrintJob = new FlexPrintJob();
    if (printJob.start() != true) return;
    printJob.addObject(my_vbox, FlexPrintJobScaleType.SHOW_ALL);
    printJob.send();
    So is there a solution that as easy as this one to "print" my
    whole template into a pdf? I have tried AlivePDF but it doesn't
    support pdf creation from IUI component(s).
    Thanks in advance!

    Hi,
    Have you tried the addImage() method of AlivePDF? It takes a
    DisplayObject as input:
    public function addImage(pDisplayObject:DisplayObject,
    pAlpha:Number = 1, pBlend:String = "Normal", pMatrix:Matrix = null,
    pResizePage:Boolean = false, pEncoding:String = "JPG",
    pQuality:Number = 100, pX:Number = 0, pY:Number = 0, pWidth:Number
    = 0, pHeight:Number = 0, pLink:String = ""):void
    More info
    here

  • Get Machine Name and IP Address from Air Flex App

    New to Air..... Is there a way to get the name of the machine
    and the ip address for the client running the Air application? Not
    that this matters, but the applcation would be a Flex 3 application
    built specifically to be deployed to the Air runtime. I need to be
    able to have the Air/Flex application know what the client's
    machine name and ip address is. Can this be done?
    Thanks

    Hi Frank,
    Well I am using Developer Suite 10g Release (10.1.2.0.2) ..I've gone thru the link what you have sent me and noticed that whatever updations of conf file or classpath its already there so i guess needn't to modify cause I think my release 10.1.2.0.2 has did already as webutils been bundled with it.
    Well What i did is to double click on ATTACH LIBRARY and browse the location to find webutil.pll and finally attached it...even though its showing me all the procedures like clientinfo and others...
    on my block's canvas I've put a button and used this trigger to get client info function like this.
    when-button-pressed trigger of INFOBUTTON
    DECLARE
    o_clientinfo varchar2(50) := Webutil_clientinfo.GET_HOST_NAME ;
    begin
    message(o_clientinfo);
    end;
    but when I am trying to open this form its simply not showing up..strange thing is that there is no error as well...so plz kindly guide me how to get clientinfo hostname or ipaddress using that library function.
    thanks

  • How to design a flex app so that it loads fast

    hi,
    i was gonna make a large CRM+ERP app in flex and was worried
    it would take a long time to load as even the smallest examples on
    various sites take quite a bit of time to load (quite a lot more
    than simple flash apps, why ??).
    i was thinking of breaking each component into individual swf
    but was afraid that it might make them pretty stand alone and not
    allow accesing their properties etc.
    what would be the simple and effective way to do this.
    can anyone point me to any large app developed in flex 2, i
    am also thinking of developing a Project Management app based on
    netoffice after this app. only if this gets developed succesfully
    coz macromedia used to have this great ability to make its flash
    look like the ultimate tool even when it had major short comings
    (one of them printing still exists in flex)
    thanks

    thanks man that was so much help. hope they update it for
    flex 2.
    also couple of queries.
    1.) does the form container carry the same overhead as other
    containers. (if not flex builder shud have stuff like auto layout
    and then when you are happy with layout you can set stuff to
    absolute layout and it auto fills widths, heights, x and y)
    2.) if i create components thru code as like in a for loop
    load time wud be same for 2 or 100 or 10000 components right.
    3.) another question similar to 2 is that if i dont use any
    outside controls load times shud be almost same for small app and
    large apps since all i am doing create instances of already
    existing control classes.
    4.) if i break down my app into components and then load them
    as needed wud it be same as creating each as a swf and loading
    them.
    5.) is layout using self written code faster than auto
    layout. (for simpler forms)
    6.) is creating controls via AS faster than creating them
    mxml.
    7.) is there any pauserefresh / pauselayout for when you want
    to add a lot of stuff and dont want to do auto refreshes.
    10x again for that link
    i will be posting my own research into optimizations in this
    thread too as i proceed with these apps

  • How do I delete uninstalled Apps from the iPhone app list that is shown inside iTunes on my PC after sychronizaton?

    To clarify and to not receive the answers of those who doesn't read more than 2 lines of a post: I am not asking how can I delete backups to free space in iCloud nor how to hide the purchase history!!! those things I already know...
    to be clearer please let me explain what I mean by "list inside the iTunes of my PC". To access the list to which I am reffering you must take this steps:
    1) Connect the iPhone to the PC. This should open iTunes if not already opened and activate the synchronization between iPhone and PC.
    2) After syncronization and eventual backup in the iTunes window on the top right side it appears the tab "iPhone".
    3) Click said tab "iPhone" to see its content. In the top bar you can see 9 tabs: "Summary", "Info", "Apps", "Music", "Movies", "TV Shows", "Books", "Photos" and "On This iPhone".
    4) Click the 3rd tab, the one named "Apps", in this window on the left side you have the full list of the apps and on the right side you can see how these apps are arranged inside the device (inside home screens and folders).
    I am referring to this particular list, the one on the left side of this page. See, I ricently run out of space in my iCloud so I decided tidy things up. I deleted all of the old backups both form iCloud and from PC and I hid all of the Apps that I no longer use from my purchase history.
    now, the point is, every time I go to this particular list I can still find all of the apps, even those uninstalled from the device and removed from the purchase history...
    In this list the apps that are still installed on my divece have got the "remove" button at its side and those which are not have got the "install" button... my point is that I went to great lengths to clean everything and still I can't seem to find a way to remove unwanted apps from this particular list...
    I do suspect that it is because I have to restore some registry inside the iPhone itself... The point is that I don't want these apps to appear on this list anymore but I don't know how to clear it... Any help? Have I been clear?
    thanks

    That list includes all the apps that you installed to your device directly from iTunes on the computer, or which were purchased on the iOS device and subsequently transferred to iTunes on the computer.
    If you right click on any item in that list and choose "Show in Windows Explorer" it will open your iTunes application installer directory on your computer, which should be:
    C:\Users\User\Music\iTunes\iTunes Media\Mobile Applications
    In there are all your saved application installers (*.ipa files).  You need to delete those actual installer bundles and then make sure to NOT allow the "transfer purchased content" when you sync or backup in iTunes (as that will just put them back on your hard drive).
    One caveat to removing those, is that if you ever wish to keep a specific release of a particular app, and the developer replaces the iTunes/App store version with something else, your sole source for your older version will be your own stored copy of it.  So for example, when PDF expert released their iOS 7 update, and charged everyone full price for it, if you wished to keep using the previous version on your own devices, then you needed to keep a copy of the installer on your own computer as that older version is no longer available in the store front.

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

  • A Flex App in browser is a swf file or translated to Javascript

    A Flex App in browser is a swf file or translated to Javascript?
    Like Flash web site plugins [not whole browser window], exist and Flex plugins?
    These are both swf files only without other supporting files?

    A Flex app is a SWF and is not translated to Javascript.  Many Flex apps do
    use Javascript to handle history management and startup focus.

Maybe you are looking for

  • External (Time Machine) HD won't mount

    I have an external Hard Disk (CnMemory, 1.5 TB, USB 3.0), partitoned as 1TB MS-DOS-Fat, ½TB Mac OS Extended. The HD has been working for months as Time Backup for my MacBookPro, the other as Data Backup for Windows and OS/X (Maverick). Suddenly the b

  • Powerbook G4 won't start up either in normal mode or safe mode

    Hi everybody, my fiance has a PB G4. Yesterday he wasn't able to boot his computer anymore. It got stuck w/ the gray screen and the spinning wheel. I started it in verbose mode as well as in single user mode to do the fsck but with no avail. The syst

  • Export to Quicktime Movie rerendering. Why?

    Hi I have a DV project edited in FCP 5.11 which is all completely rendered. It's actually made up of a number of sequences joined end to end each of which is rendered before rendering the final 'top' sequence. There are some heavily rendered motion s

  • Clientgen Ant task

    I was getting this below error when iam trying to run the clientgen ant task if you could provide a solution for this that will great and this error code I got from bea site it talks this saying as been fixed in sp3 but still was working on sp4 (CR12

  • [SOLVED]Trying to install package-query again. Cannot find PKGBUILD.

    I'm updating my arch after 4 months. Yes it has been a long time. During the update process I had to remove package-query and yaourt, and now I'm trying to get them back. I got package-query from here https://aur.archlinux.org/packages.php?ID=35915 U