AS3 pass variable values of external swf loaded in the parent swf format

Hello

I'm working on an e-Learning project that uses a main SWF (SWF1) and a second SWF (SWF2) with 2 quizzes in it. Published in the ATMOSPHERE for Desktop and Android, SWF1 and SWF2 are packed together in the Office of AIR or AIR APK exports.

I use a charger in SWF1 to compose and execute SWF2. What I am having difficulties with, need help, is how to get 2 2 SWF2 quiz scores and load these values (each is a number) return SWF1. Once back in SWF1, they will be written to a string and then displayed in a text box using textbox.text.

While I searched online and found examples to send variables from parent to child of the SWF file, so far not able to find an example of script understandable/useable AS3 to get variables from child to parent SWF.

Any help appreciated.

Best wishes

The best way to communicate between parent and child SWFs is through events. Send an event to the child with the data to send and intercept the event to the parent level. This flow is common and very easy to handle

Tags: Adobe Animate

Similar Questions

  • 'Detect' a variable from an external SWF loaded via SWFLoader

    I load an external SWF file to a click event.  Then, when interactions has reached the end of the presentation, we would like what he offload and go into another State.

    Is this possible?  (actually turned the SWF into a component using Flash Builder 4 in the hope that it would be easier to detect variables and events)

    Thank you

    Doug

    It is possible, but you will have to wire upward communications between the

    Sovereign wealth funds

  • Passing variable pageflowScope JavaScript on page load event


    Hello

    I'm attempting to pass pageflowScope value of the variable in the javaScript on the page Load method.

    < af:resource type = "javascript" >

    getTitle (evt) {} function

    var titleString = document.title;

    Alert ("Welcome1");

    Var manual = evt.getSource () .getProperty ('rowKey');

    Alert (Manual);

    }

    < / af:resource >

    < af:form id = "f1" >

    < af:clientAttribute = name value = "#{pageFlowScope.readOnlyParam}" / "rowKey" >

    < af:clientListener method = "getTitle ()" type = "load" / > "

    < / af:form >

    First alert got printed but I don't get the value of the variable pageFlowScope in Javascript...

    Any help will be appriciable.

    Kind regards

    Krishan

    ,.


    Hello

    Add after the code inside

    tag

    function onPageLoad (evt) {}

    Alert (evt. GetSource(). GetProperty ('vattr'));

    }

    and it does not work for me

  • passing two values in a guest column for the display and filtering

    Hi all

    Is there a workaround solution to use two columns in a command prompt to display and the passage of the input for a prompt value in dashboard prompt value? For example we want to display the description in the command prompt, but pass the variable value or the presentation of the filter id, just as we have in bi publisher, LOV automatically enter the value both for the display and the actual value to pass to the query. Therefore, the user clicks the description and corresponding id will be stored in the variable presentation of the guest of.

    Thank you

    Sushil

    Published by: 872073 on April 5, 2013 11:06

    Check this box
    http://www.rittmanmead.com/2010/08/Oracle-BI-EE-11g-handling-double-columns-iddescription-interoperability/

  • programmatically set the bind view variable value of object that showed to the query Panel

    Hello

    I have a case in 11.1.1.7 Jdev, I deploy my application on BPM 11.1.1.7.

    I have a VO that three attributes of it was put in a viewcriteria... Let's attribute A1, A2, and A3. the view criteria is any condition "AND".

    and then I create a variable binding in the VO named b. my vo also query using this variable B.

    in the jspx, I create a query panel based on the viewcriteria. then in the A1, A2, A3 and B query pane shows.

    I can reset the Panel request programmatically using this tutorial http://www.jobinesh.com/2011/04/programmatically-resetting-and-search.html

    but unfortunately he didn't succeed for A1, A2, A3 because they are in the display criteria, but B can't reset.

    I tried to put the value programmatically using queryModel, queryDescriptor, setNamedWhereClauseParam, but this failed and it starts to makes me crazy...

    anyone here seen cases like me? and found the workaround? pls throw some light.

    Thank you

    Have you tried with VariableValueManager? http://www.jobinesh.com/2010/10/how-to-set-bind-variable-values-at.html

    Dario

  • Alert box does not work when the swf is loaded in the parent file

    I'm having a problem. The code pasted below works fine. But when I load the file flash in a flash file 'parent' (the interface on the site), the alert message and audio don't work more.

    Here's the code - this is for when a user fills out a form, and the shot of the 'next' button

    on (release) {}
    if(selectedTrim=="")
    {
    mx.controls.Alert.show ("you must select a level of finish before you continue.", "BEWARE");
    }
    on the other
    {
    var mySound:Sound = new Sound();
    mySound.attachSound("btn-swish");
    mySound.start (0,0);
    gotoAndPlay ("TrimToColor");
    }
    }

    any ideas?

    thought about it - I neeed to add to the library of the project "parent".

  • Send the keyboard event of the clip loaded by the parent mouse click

    Hello. I'm building a swf wrapper that loads the third-party swf games. The customer wants a button in the package, that will send a keyboard event in the loaded swf file.

    Can someone give me hand on how to build an event to send in the wrapper which penetrates into the loaded swf file?

    Thank you very much!

    After that is finished loading:

    MovieClip (yourloader.content) .dispatchEvent (new KeyboardEvent (somekeyboardevent));   If the loaded swf file is a movieclip

  • AS3 &amp; Coldfusion variables

    I want to know if I can record answers to the questions asked within flash and then pass them to flash using coldfusion to a database, so they can be saved, what I have to do Flash Remoting?  or is it better to pass out in a long URL variables?  someone at - it examples would be useful.  I could not find.  Thank you.

    You can use the urlloader class to call a cf script and pass variables/values like calling a script on the server side:

    var urlLDR:URLLoader = new...

    var urlREQ:URLRequest = new...

    var urlVAR:URLVariables = new...

    urlREQ.url is your cf file path/name;.

    urlLDR.addEventListner (Event.COMPLETE, completeF);

    function sendF(variableA:Array):void {}

    for (var i: int = 0; i<>

    ["var_" + i] urlVAR = variableA [i];

    }

    urlREQ.data = urlVAR;

    urlLDR.load (urlREQ);

    }

    function completeF(e:Event):void {}

    urlLDR.data is the return of the CF script

    }

  • to access methods and variables to an external loaded swf

    OK, I've been at this now for 2 straight days without success. I use external SWF as a way to customize the GUI design. The main swf default is supposed to load the external SWF and manipulate variables and methods. When I have the debug, it seems to appear on the stack which load upward variables of the external swf file. but when I try to handle it on the maintimeline, such as _level0.active_comp.name_space_header = 'Hello', it is no longer as original value defined in the SWF external or worse still undefined. I shopped, in tutorials, guide assistance, search engines, and there is no indication in the right direction, only that it should work, not that it works.


    in other words, in the external compiled swf, I put a text box empty, give the name of the instance 'name_space '.
    in the main timeline of the swf by default, I perform a simple operation createEmptyMovieClip/loadmovie.
    then on the second image, I enter custom text to be put in the external clip loaded, in the form of _level0.active_comp.name_space_header = "Hello"; and that's all, nothing. I can not even access the variables on
    any point given the default timeline. HHHEEEELLP. !!! Arrrrrgh

    The Movieclip object is only part of the answer, the real answer is the FPS of the main sequence, load the external swf file. The faster you set the time, faster it ends the loading process. So ideally, you want to set the main.swf to 120 frames per second, which is the maximum and movies of time forced as an external process. All external swf which carries only action script, inline must also be set to 120 images per second. You can create a custom Init() function to run only when the byte loading criteria has been made. This prevents a hiccup in the code and have a process of interrupted line. Anyone interested in the code example, please do not hesitate to send me an e-mail to [email protected]

  • Load external SWF AS2, pass him a root variable

    Hi all

    I create a program AS3, but unfortunately I need to load legacy SWF files that I can't change. These old files are dynamic graphs, and each of them is powered a XML file with its data.

    The original implementation had these graphic files on HTML pages, and each received his URL data file on the query string, as follows:

    < PARAM NAME = movie VALUE = "FC2MSColumn.swf? dataUrl =... / ChartXML/ideationbyage.xml" >

    My problem is that I now need to charge these same SWF files in my AS3 program and somehow the feed this variable _root in the same way, he would have gotten them in the original implementation of HTML. So, I am confused on how to do this however. I heard grumbling on the methods of Localconnection, but in my case I don't need to read anything of my old AS2 files, I need to set the initial value, as if I'd put the file on a Web page and given a value of query string or flashvar.

    Any pointer or advice would be greatly appreciated! I would be surprised if this was not possible.

    Well it took a little bother with it, but yes, Raymond's suggestion worked. As he says, it works in the browser. I had to make some minor changes, like how he had results in a type constraint error when you try to directly enter the file path in the application. In the end, I ended up with this:

    var imgDisplay:Loader = new Loader;
    var url: String = screenXML.image [imgtoload] + '? dataUrl =' + screenXML.image.@df;
    var req:URLRequest = new URLRequest (url);
    imgDisplay.load (req);
    displayContainer.addChild (imgDisplay);

    Thanks for the suggestion, which saved me a huge amount of hassle.

  • SWF loaded, passing variables

    If I load a swf movieclip into a parent SWF is using:
    _root.loadMovie ("bar_chart.swf");
    How can I can pass variables in the parent swf using AS?

    Is it possible to use _global to declare a global variable in the parent, then access this in the swf file that is loaded:
    Parent:
    _Global.test = new Array();
    Load:
    [x] test = y;
    (well it does not work as I have tried, but something along those lines)

    Basically I'd like any info on how I could pass variables between a loaded swf and its parent, but try to keep it in terms laymans terms because I'm not so hot on the action script.
    Thanks for any help in advance!

    Place the code in the first frame of your movie. its working fine. I don't know why you want to call a function the external swf file perticular.

    _Global.bars = new Array();
    for (i = 0; i! = 5; i ++) {}
    bars.push (i);
    }
    var total = 0;
    var a = _global.bars.length;
    for (i = 0; I! = a; i ++) {}
    Total += _global.bars;
    }
    for (i = 0; I! = a; i ++) {}
    this.createEmptyMovieClip (("bar"+i), this.getNextHighestDepth ());
    var color = "0 x" + random (9) + random (9) + random (9) + random (9) + random (9) + random (9); "."
    This ["bar" + i] .beginFill (Colour);
    This ["bar" + i]. MoveTo (((i/a) * 100), (100-(_global.bars/total*100)));
    This ["bar" + i]. LineTo (((i+1) /a) * 100)-1), (100-(_global.bars/total*100)));
    This ["bar" + i]. LineTo (((i+1) /a) * 100)-1), 100);
    This ["bar" + i]. LineTo (((i/a) * 100), 100);
    This ["bar" + i]. LineTo (((i/a) * 100), (100-(_global.bars/total*100)));
    This ["bar" + i] .endFill ();
    }

  • How to pass parameters to external swf with the loader?

    Hello everyone

    I am loading an external swf file using the charger. It's a pdf file converted to swf format.

    How do I pass parameters to the file so that I can highlight certain words in the file?

    Thank you

    Hello everyone

    I solved this problem.

    Thank you

  • Loading external SWF in as3 SWF Loader style?

    Hello

    I recently did the replacement of as2 as3 and am still struggling to get my head to a particular aspect. I managed to load an external swf into an empty file via the script

    Import LoadDisplayObject;

    var loader: LoadDisplayObject = new LoadDisplayObject ("button_01.swf", true);

    1. loader.addEventListener ("displayObjectLoaded", onComplete, false, 0, true);

    addChild (loader);

    function onComplete(evt:Event):void {}

    trace ("received full load");

    loader.scaleX = loader.scaleY is. 75;

    }

    ... but I'm struggling with the script to make a SWF to load into a space when one of my 3 buttons is activated...

    My page currently has three buttons (button_01, button_02 and button_03) and in a local folder three separate sovereign wealth funds with the same names that I want to load, when you press the appropriate button.

    I managed to get them to load using a tutorial... but what they charge on top of each course... far from ideal. Research on the internet I found a range of different script... goal, that I can't find anywhere that I can find the script to make it work... so why I turned here.

    Any help much appreciated... Thanks in advance.

    Simply call butt1Click (null);

  • AS3 communication with external swf loaded in mc

    Hi all

    Thanks for posting first

    My problem is this, I have a blank swf file that loads a swf into a clip called content_mc here is the code located in the blank swf file

    startLoad ("home page")

    var loadedSWF:Loader

    var content_mc:MovieClip = new MovieClip();

    function startLoad (SWFname:String) {}

    loadedSWF = new Loader ();

    loadedSWF.load (new URLRequest (nomswf + ".swf"));

    content_mc. AddChild (loadedSWF);

    function nextSWF (whichSWFName, removeSWF) {}

    content_mc.removeChild (removeSWF);

    If whichSWFName == 'start page') {}

    startLoad ("pre-loader");

    }

    }

    so this basically puts everything up now on the button of the swf file loaded on the outside I

    btn.next.addEventListener (MouseEvent.CLICK, nextpls);

    function nextpls (event: MouseEvent) {}

    MovieClip (parent.parent) .nextSWF ("home page", parent);

    }

    OK to explain if I remove the content_mc of the first part of the code that everything will work as it should

    the problem is that I need to load into this movieclip

    so I need to tell the MovieClip content_mc which its finished passing ("home page", parent) bit

    However I can't communicate with him

    I don't know if I did not have enough parents or if I need to say () and so on

    Maybe I need a reference or something ive read on those.

    currently learning AS3 and this part is a real headache

    any help is greatly appreciated

    Thank you

    fonzio1

    Should be more like this:

    Child ("home page")

    import flash.events.MouseEvent;
    import flash.display.MovieClip;
    
    btn.addEventListener(MouseEvent.CLICK, nextpls);
    
    function nextpls(e:MouseEvent):void {
        (parent.parent.parent as MovieClip).nextSWF("startPage", this);
    }
    

    Parent

    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.net.URLRequest;
    
    var content_mc:MovieClip = new MovieClip();
    addChild(content_mc);
    
    var loadedSWF:Loader;
    
    function startLoad(SWFName:String):void {
        loadedSWF = new Loader();
        loadedSWF.load(new URLRequest(SWFName+".swf"));
        content_mc.addChild(loadedSWF);
    }
    
    function nextSWF(whichSWFName, removeSWF){
        content_mc.removeChild(removeSWF.parent);
        if(whichSWFName == "startPage"){
            startLoad("pre-loader");
        }
    }
    
    startLoad("startPage");
    

    (Personally I use communication based instead of AS1 as "parent.parent" etc...)

  • With the help of a button to load and unload the external SWF in AS3?

    How can I use a button to load and unload a sequence of external SWF files, as a Next button and previous?

    I don't know if it will work because apparently you are trying to load a swf AS1/2, but try

    change the line to be...

    _swfTempClip = MovieClip (event.target.content);

    If this does not work, then you will need to create _swfTempClip as a new MovieClip and add the event.target.content to this MovieClip using addChild().

Maybe you are looking for