Calling functions / setting variables in loaded SWF

You know how you can create a Movieclip object, add a
function or variable to it, then call that function or change that
variable from within the SWF that includes it? I wanna be able to
do that, only with SWFs that are loaded at run time.
My "main" SWF is simply a menu-type thing. The user clicks a
button in my MAIN.SWF, and the MAIN.SWF then loads the SWF that's
associated with that button, using the AS 3.0 prescribed
Loader()-URLRequest()-addChild() method that everyone always asks
about.
This works great. But now I've got some custom objects and
such (ie., not just strings) within my MAIN.SWF that I'd like to be
able to share with the loaded SWFs. Preferably, I'd like to use an
accessor-type function (ie.,
LoadedSWF.GiveMeTheCoolObject(MyCoolObject);), though at this point
I'm willing to hack into the object itself (ie.,
LoadedSWF.CoolObject.CoolField = MyCoolObject.CoolField;) if that's
what it takes.
I've tried just calling the functions and setting the fields,
but the AS 3.0 compiler doesn't care for that sort of nonsense on
it's generically-defined objects. Notice also that, at run time, a
call to LoadedSWF.hasOwnObject("GiveMeTheCoolObject") returns true.
So my big-brained colleagues, what's the magic?
In advance, thanks for the help!
Scott

Kglad,
quote:
Originally posted by:
kglad
from that error message it appears your function is expecting
a member of the MyCoolObject class, correct?
and MyCoolObject is not an instance of that class. so, you
need to fix that. ie, create a member of that class and use that
class member as the function parameter.
Heh, that's what the error message says all right. But the
object actually IS a MyCoolObject class object. I stared at this
thing for hours, and MyCoolObject IS an instance of that class. I
tried various casting combinations (including casting it to an
Object and passing that) but had no luck whatsoever.
So I googled this particular runtime error message ("Error
#1034: Type Coercion failed: cannot convert ") and found a ton of
links to other people having a similar issue. Typically, the
problem was just as you said, someone passing a button as a string,
that kinda thing. But one guy had a problem with an object he
derived from the Event class. After hours spent trying to get it to
work, he tried overriding the base class' clone() method and got it
to work:
http://www.asserttrue.com/articles/2006/10/14/custom-events-in-actionscript-3-0
As for my project, I took a long hard look at the overall
architecture of my project and decided that it was best if all the
"real work" took place in the MAIN.SWF file. This approach would
solve a couple of other problems, and it just makes sense in a
"separate the display from the data" mentality.
So (and this is the interesting part) I changed the API for
the LOADED.SWF to accept String pairs (ie.,
LoadedSWF.AddToDisplay(Name:String, Data:String) ) instead of
accepting MyCoolObj. Ran it, and Viola, now we're working without
any run time exceptions. After that glorious moment, I created a
couple of other APIs that just accepted base classes (one an int
type, the other a function type) and was happily on my way.
From this, I gather that passing non-base class (ie, derived
class) objects to loaded MovieClips via custom function APIs is...
maybe not as straightforward as we'd expect. In the grand scheme of
things though, not a big deal: As far as I'm concerned AS3 rocks.
Again Kglad, thanks for all the help: Your input on how to do
this was the big push that I needed to get over the last technical
hurdle of this project.
To those who are reading this topic for the "how do I call
functions and/or set variables in a loaded SWF?"
The short answer is to cast the loaded SWF's content object
as a MovieClip and then call the function or alter the variable:
//Load the SWF (you've seen this code a million times)
var LoadedSWFObj:Loader = new Loader();
var MyURL:URLRequest = new URLRequest("LoadThisSWF.SWF");
LoadedSWFObj.load(MyURL);
//This is within your Event.COMPLETE handler:
//Cast it as a MovieClip object and work with that.
var LoadedSWF:MovieClip = LoadedSWFObj.content as MovieClip;
// or another way to cast it is:
var LoadedSWF:MovieClip = MovieClip(LoadedSWFObj.content);
//Call yer function:
LoadedSWF.CallMe();

Similar Messages

  • Trying to call a root level function from within a loaded swf

    I'm not very familiar with AS3... I'm trying to have a loaded swf file call a function from the parent to unload itself when it comes to the end (on the timeline, not as a button). I'm assuming I need to be calling the function (that is used for the close button) from the loaded swf (perhaps I'm mistaken though?).
    Here's the code from one of my buttons that loads an swf. I'm guessing I need to call the closeSWF function from the timeline of my loaded movie but having no luck figuring out how to do that.
    Any help would be appreciated.
    // 01 ------------------------------------------------------
    function loadWeaving(ev:MouseEvent):void {
      // load SWF
      var movieClip:MovieClip = new holder_mc;
      //add it to the stage
      addChild(holderSWF);
      holderSWF.x=0;
      holderSWF.y=0;
      var requestEN:URLRequest = new URLRequest("WhatIsWeaving_Eng.swf"); // english
      holderSWF.load(requestEN);
      close_bt.addEventListener(MouseEvent.CLICK, closeSWF);
      function closeSWF(infoObject:Object):void {
      trace("close SWF");
      removeChild(holderSWF);
      // reset switch
      close_bt.visible = false;
      showAllButtons();
      infoObject.currentTarget.removeEventListener(infoObject.type, closeSWF);
      setChildIndex(close_bt,numChildren - 1);
      close_bt.visible = true;
      hideAllButtons();
      // - start timer last
      myTimer.addEventListener(TimerEvent.TIMER, closeSWF);

    You're exactly right. If you attach an event listener to the Loader before you add it to the stage, you can then use event.currentTarget to refer to the loader. And this is definitely the better way to do it if you're planning to use the loaded swf from multiple places or could ever need to do this in the future.
    So:
    protected function initLoader():void {
         var loader:Loader = new Loader();
         loader.addEventListener('closeMe', closeLoader);
         loader.load(new URLRequest(...));
         addChild(loader);
    protected function closeLoader(e:Event):void {
         var loader:Loader = e.currentTarget as Loader;
         if (loader) {
              loader.unloadAnstop(true);
              loader.removeEventListener('closeMe', closeLoader);
              removeChild(loader);

  • How to call a set variable?

    Greetings,
    I am creating an apple script that runs a netstat command to grab an IP address. This works.
    The "Set Value of Variable" (called XX) shows the IP address that netstat runs.
    The next apple script activates "Terminal" just fine.
    Within Terminal, I want to tell it to "telnet" to the IP address from the Set Variable and this is where I am stuck. How do I tell it what "XX" is?
    Thanks,

    If it is the only input item in the input (previous actions can contribute to the input), your statement would be something like:
    set DG to item 1 of the input
    If you are only using the variable in your second AppleScript action, you can also just combine them:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #FFEE80;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters}
    set DG to (do shell script "netstat -nr | grep -w 'default' | awk '{print $2}'")
    tell application "Terminal"
    activate
    do script "telnet " & DG
    end tell
    return input -- pass on the input
    end run
    </pre>

  • Setting Variables to embedded SWF in Director

    I have a print button on screen at the end of a test within
    my director project. Once the user completes they are able to print
    there results. I have a certificate created in Flash publised using
    player 7 AS2 which is suppose to recieve varibles and populate text
    fields on stage.
    This works perfect when testing within the authoring
    environment or when using a projector but when using Shockwave it
    doesn't seem to send all the variables to the flash movie.
    therefore does not trigger the flash printObj command.
    Now last time I checked the project online it was working
    perfect in Shockwave 10.1 and the earlier version of shockwave 10.2
    I noticed with shockwave 10.2.0.23 the latest version it
    crashes out the browsers. I have fixed it from crashing but not all
    the variables are getting to the flash movie.
    I am using:
    on mouseUp me
    pPrintMe = true
    end
    on exitframe me
    myCallBack= sprite(pPrintSprite).getVariable("drCallback",
    true)
    if pPrintMe=true then
    setVariable(sprite(pPrintSprite) , "drTitle",
    string(myObjectList[#CBT][1]))
    setVariable(sprite(pPrintSprite) , "drName",
    string(myObjectList[#firstname] & " " &
    myObjectList[#lastname]))
    setVariable(sprite(pPrintSprite) , "drTID",
    string(myObjectList[#tid]))
    setVariable(sprite(pPrintSprite) , "drModule", "Has
    completed the test for the above training package with the
    following results:")
    setVariable(sprite(pPrintSprite) , "drScore",
    string(gtestPList[#score][1] & " out of " &
    gtestPList[#score][2] & " points"))
    setVariable(sprite(pPrintSprite) , "drPercent",
    string(gTestPList[#score][4]))
    setVariable(sprite(pPrintSprite) , "drDate",
    string(baSystemTime("%0d-%b-%Y")))
    setVariable(sprite(pPrintSprite) , "copyright",
    "Copyright© "&string(baSystemTime("%Y"))&" Company
    name")
    end if
    end
    Now simple enough code. I blame Adobe for breaking my
    code!

    O yes, i have very similar problem to this, where since i
    have updated to latest version of the shockwave player, not all my
    variables are passing through to flash (version 8) and my web
    browser is crashing out.
    What can i do about this?

  • Controlling a Movie Clip on the Main Timeline from a loaded SWF?

    Is it possible to control a MovieClip on the main timelne from another loaded clip?
    I see posts that control loaded clips, but most are all from the loader in the main timeline.  I have a moviclip on the main timeline that I want to make visible or invisible depending on what keyframe is playing in another loaded swf.
    If I try to call the movieClip from the loaded SWF I get "error #1119.  Access of possibly undefined property...." because it doesn't exist in the loaded SWF, just the main timeline. 
    The old AS2 way just used "_root".  Since "_root" doesn't exist any more, how do you control items on the main TimeLine from a loaded SWF?

    I am not clear what you mean because you are saying you are trying to target a movieclip that does not exist where you are trying to target it.
    Try using a trace to see what you are targeting when you you target the MovieClip(parent.parent)....
    trace(MovieClip(parent.parent));
    The other approach I mentioned earlier is the more OOP-correct approach if you would rather try that way.  Here's a rough outline of it...
    AS3 - Dispatch Event
    http://forums.adobe.com/thread/470135?tstart=120
    Example:
    Add something to trigger the event in the child (your loaded swf):
    dispatchEvent(new Event("eventTriggered")); (
    if dispatchEvent problem, see: http://www.kirupa.com/forum/showthread.php?p=1899603#post1899603)
    In your loading/parent swf, listen for the complete event on the Loader.contentLoaderInfo.  In the complete event handler, add a listener for the event on the loaded swf.
    // event handler triggered when external swf is loaded
    function loaderCompleteHandler(event:Event) {
        MovieClip(event.currentTarget.content).addEventListener("eventTriggered", eventHandler);
    function eventHandler(event:Event):void {
        trace("event dispatched in loaded swf");
       // this is where your main file can set the visible property of your movieclip

  • Using loadMovie to load SWF linked to FLV

    I am having problems getting a movie (SWF) with an linked FLV
    file to play when I use loadMovie to load it in.
    I have an .FLV file named vid_9.flv. I have embedded it into
    a Flash movie named vid_9.swf using Flash 8 Professional. I am
    using "Progressive Download from a Web Server" and no controls.
    When I play the SWF on the stand-alone player (the FLV is in the
    same folder) it works great. Now when I call that SWF into another
    movie using
    swfHolder.loadMovie("SWFs/vid_9.swf");
    it shows it being completely loaded, but then never plays,
    all I get is a white screen. This is my second project in a row
    where this did not work. Any ideas as to why? Thanks for any
    help.

    onLoadComplete executes before the loaded swf's assets are initialized:  use onLoadInit.
    those function definitions in your loaded swf should NOT be in an onLoad method.  if they are defined on the main timeline of the loaded swf, use:
    var url:String = "scene05.swf";
            var movieClip:MovieClip = createEmptyMovieClip("movieClip", 0);
            var listenerObj:Object = new Object();
            listenerObj.onLoadInit = function (target_mc:MovieClip):Void {
                //It should execute these functions that are located in the onLoad event in the loaded swf.
                target_mc.initBackground();
                target_mc.initBackgroundWeg();
                target_mc.initVehicles();
                target_mc.initForeground();
                target_mc.initKnoppen();
            var movieClipLoader:MovieClipLoader = new MovieClipLoader();
            movieClipLoader.addListener(listenerObj);
            movieClipLoader.loadClip(url, movieClip);

  • Permission to set variable LOGLEVEL  by user

    Is anybody who knows which privileges I have to grant to user to avoid error:
    [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 13015] You do not have the permission to set the value of the variable 'LOGLEVEL'.Please have your System Administrator look at the log for more details on this error. (HY000) SQL Issued: {call NQSGetQueryColumnInfo('SET VARIABLE LOGLEVEL=5; SELECT "Project history"."ID" FROM "Projekty VDP"')}
    User isn't administrator and he shouldn't be.
    I need to debug sth from user perpective.
    I was loking in documentation but without success.

    Hi,
    If the LOGLEVEL variable is overriden in RPD, then you need to check the option 'Enable any user to set the value' to set the variable by SET VARIABLE LOGLEVEL = 2; in Answers. If this option is not checked you will receive the above error if anyone besides Administrator tries to set loglevel at answers.
    Thanks

  • How? Flex pass variables or call function in SWF

    Dear All:
    I am new in Flex.
    But I stuck with a problem for weeks.
    I wish to communication between Flex and Flash(swf).
    I tried to pass variable from Flex to Swf. (Call function in Swf also pass variables)
    I did some tourital on google by using SWFLoader, which works fine.
    BUT the AS code in SWF must in MAIN FRAME.
    I need put my AS code by using DOCUMENT CLASS.
    BUT when I using Document class, the method is not working.
    The flex cannot find function in Flash.
    PS.I already set main.as class as public
    Hope some one can give some hint.
    I really get a huge headache.
    Many thanks,
    Henry

    myIP wrote:
    > or perhaps more ideal;
    >
    > for(var sVar in flashVars)
    > {
    > i++;
    > //var mcName = sVar.substr(0,3);
    >
    > // create the MCs:
    > duplicateMovieClip(_root.testBut,"medium"+sVar,i);
    > _root["medium"+sVar].testText.text=sVar;
    > _root["medium"+sVar].mcName = sVar.substr(0,3);
    >
    >
    > // assign the function to each created MC:
    > _root["medium"+sVar].onRelease = function()
    > {
    > trace(this.mcName)
    > _root[mcName]._x=0;
    > }
    > }
    >
    thanks but this does not work.
    I think that the problem is that the variables defined in the
    for loop do not exist in the scope of
    the function.
    when the MC is clicked, and the onRelease function says:
    _root[mcName]._x=0;
    the variable "mcName" is empty.
    seb ( [email protected])
    http://webtrans1.com | high-end web
    design
    An Ingenious WebSite Builder:
    http://sitelander.com

  • Loading External SWF and setting variables

    Hello Everyone.
    I'm sure you are all a where of the FlashVars attribute for
    Flash embeds which holds variables for SWF's when they are
    rendered. I'm attempting to load an External SWF dynamically
    from within my own SWF and need to provide it with the values
    normally stored in the FlashVars. For the example below I
    wait until the External SWF is completely loaded using the
    onLoadInit event from moviecliploader and then i attempt to
    set the required variables that the loaded SWF needs. This works
    great in test and debug mode (ie. Test Movie and Debug Movie
    from the Control menu), but when i publish my FLA to SWF and run
    the SWF the variables will NOT get set in the loaded External SWF.
    From my readings ive people have mentioned that the player is only
    able to access Methods of an External SWF. If this is the case then
    how do they expect people to set the FlashVars of dynamically
    loaded SWFs? I investigated the loadVariables procedure as well and
    had the same results in test mode and was wasn't reliable because
    of timing issues.
    The sample source is below... if anyone has any ideas or has
    come across this issue before, I would really appreciate some
    insight.
    Thank you in advance for your time.
    var loader_mc:MovieClipLoader = new MovieClipLoader();
    var mclListener:Object = new Object();
    loader_mc.addListener(mclListener);
    mclListener.onLoadProgress = function(target_mc:MovieClip,
    numBytesLoaded:Number, numBytesTotal:Number) {
    // DO NOTHING
    mclListener.onLoadComplete = function(target_mc:MovieClip) {
    // DO NOTHING
    mclListener.onLoadInit = function(target_mc:MovieClip) {
    // WORKS IN TEST MODE NOT IN PUBLISH/SWF MODE
    target_mc._root.param1 = "value1";
    // WORKS IN TEST MODE NOT IN PUBLISH/SWF MODE
    _level0.container_mc.param1 = "value1";
    this.createEmptyMovieClip("container_mc",
    this.getNextHighestDepth());
    container_mc._lockroot = true;
    loader_mc.loadClip("somecoolflash.swf", container_mc);

    I've tried that as well and it behaves the same as onLoadInit
    ... Works when i test but doesnt when i publish to a swf. I think
    this is security related and the flash player just cant write to a
    loaded swf and set variables.

  • Calling a function in the main movie from a loaded swf

    I realize this is probably a very basic question, but I have
    loaded a SWF file into another movie. I now want to call a function
    in the main SWF. Is there a way to do that? Alternatively, I have a
    custom class where I could put the function, but I haven't been
    able to figure out how to call it from the loaded SWF either. Do I
    somehow need to associate the class with the main movie,
    or...?

    Never mind - I was doing something very stupid and wasn't
    calling the function as a method of a movie clip. I was simply
    calling checkTarget(event) rather than
    event.currentTarget.checkTarget(event); which seems to work.

  • Calling a function in a flex app from a loaded SWF

    How can I call a function in a flex application from a loaded
    swf file?

    Two ways:
    Application.application returns a reference to the top-level
    application scope. You can access any public member, var, function,
    component, etc through that reference.
    Dispatch an event event form the loaded swf and use a event
    handler in the main app. All the gurus advise this as best
    practice, to ensure "loose coupling" It is also pretty easy,
    especially if you use a bubbling event.
    Tracy

  • Calling Flex function from loaded SWF

    Hello,
    I need to load an external SWF file, wity ability to call functions from the base FLEX code script .
    Is that possible ? noting that the loaded SWF can be either in AS2 or AS3
    Thanks in advance ..

    There are some third party ways of talking to an as2 swf.  Google
    as2interface (or maybe as3interface)

  • Setting External Loaded SWF dimension

    hi guys...,
    i'll be straight to point,well i'm now working on a project using action  script 3 now what i'm trying to make is a Main SWF that load whatever  other swf into it the tricky thing is that i used 1 xml document read  the external swf source and it's setting(such as it's x,y position and  it's width and height) and i'm having problem setting the loaded swf width and  height btw it's an desktop application and not a website application.,
    here is my code:
    //variable list
    var swfList:XMLList; //hold all the zone list from the xml
    var totalZone:uint; //total of zone there is in the xml
    var myURLLoader:URLLoader = new URLLoader();
    var swf:Movie Clip;//hold the loaded swf
    var swfLoader:Loader = new Loader();//loader instance used to load the external swf
    var myCounter:uint = 0;
    //load the xml file
    myURLLoader.load(new URLRequest('myXMLFile.xml'));
    myURLLoader.addEventListener(Event.COMPLETE, processXML, false, 0, true);
    function processXML(e:Event):void
        removeEventListener(Event.COMPLETE, processXML);
        XML.ignoreWhitespace= true;
        var myXML:XML = new XML(e.target.data);
        swfList = myXML.SWF;
        totalSWF = myXML.SWF.length();
        loadSWF();
    function loadSWF():void
        swfLoader.contentLoaderInfo.addEventListener(Event.INIT, swfSetting);
        swfLoader.load(new URLRequest(swfList[myCounter].@source));
    function swfSetting(e:Event):void
        //making new instance of sprite to hold the new loaded swf
        swf = new MovieClip();
        //casting the loader content into a movieclip
        swf = e.target.content;
        addChild(swf);
        swfLoader.unload();
        swf.x = swfList[myCounter].@left;
        swf.y = swfList[myCounter].@top;
        swf.width= swfList[myCounter].@width;
        swf.height= swfList[myCounter].@height;
        addChild(swf);
        if(myCounter < totalSWF)
            myCounter++;
            trace('myCounter: ' + myCounter );
            loadSWF();
    and here is what the result ( it make the width and height of the loaded swf to 0):
    swfLoader.contentLoaderInfo.width : 320
    swfLoader.contentLoaderInfo.height : 240
    module: MyVideo/flvplayer.swf
    x:0
    x container:0
    y:0
    y container:0
    xml width:550
    width container:0
    xml height:400
    height container:0
    myCounter: 1
    swfLoader.contentLoaderInfo.width : 550
    swfLoader.contentLoaderInfo.height : 400
    module: AnalogueClock.swf
    x:50
    x container:50
    y:0
    y container:0
    xml width:250
    width container:250
    xml height:200
    height container:200
    myCounter: 2
    swfLoader.contentLoaderInfo.width : 800
    swfLoader.contentLoaderInfo.height : 30
    module: MyNewsticker/newsticker.swf
    x:0
    x container:0
    y:0
    y container:0
    xml width:300
    width container:0
    xml height:50
    height container:0
    most of my loaded swf beside the analouge clock is full action script code and in case of the analouge clock it is a swf that has a movie clip on it's stage (the other are fully created from action script 3.0)
    please do help me..,
    cause i'm already really desperate and going crazy by this problem..,

    sorry i copied the code from the other swf i used to do try and error test..,
    basically the container is the same as swf varibale
    here the code so you would'nt get confused:
    //variable list
    var swfList:XMLList; //hold all the zone list from the xml
    var totalZone:uint; //total of zone there is in the xml
    var myURLLoader:URLLoader = new URLLoader();
    var swf:Movie Clip;//hold the loaded swf
    var swfLoader:Loader = new Loader();//loader instance used to load the external swf
    var myCounter:uint = 0;
    //load the xml file
    myURLLoader.load(new URLRequest('myXMLFile.xml'));
    myURLLoader.addEventListener(Event.COMPLETE, processXML, false, 0, true);
    function processXML(e:Event):void
        removeEventListener(Event.COMPLETE, processXML);
        XML.ignoreWhitespace= true;
        var myXML:XML = new XML(e.target.data);
        swfList = myXML.SWF;
        totalSWF = myXML.SWF.length();
        loadSWF();
    function loadSWF():void
        swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfSetting);
        swfLoader.load(new URLRequest(swfList[myCounter].@source));
    function swfSetting(e:Event):void
        //making new instance of sprite to hold the new loaded swf
        swf = new MovieClip();
        //casting the loader content into a movieclip
        swf = e.target.content;
        addChild(swf);
        swfLoader.unload();
        swf.x = swfList[myCounter].@left;
        swf.y = swfList[myCounter].@top;
        swf.width= swfList[myCounter].@width;
        swf.height= swfList[myCounter].@height;
        addChild(swf);
        if(myCounter < totalSWF)
            myCounter++;
            trace('myCounter: ' + myCounter );
            loadSWF();
    well in my code i did cast the loader into a movie clip and then set it's width and heigt,right???
    wouldn't it just give me the same result??
    if it's not can u describe what u mean in more detail??
    some example about accessing the loader content would be really appreciated

  • Loading SWF into level and setting height/width/location?

    Hi folks, I am an old AS2 guy who gave up on Flash heavy coding when it switched to AS3. Always thought it was less intuitive, longer, and a brand new language and I got tired of trying to keep up when most of my clients did not want to pay for a full flash site. But I got this client...
    Here's the problem, I can load a swf into my main stage or into an MC , but I cannot find out anywhere how to set parameters or load into a level so it doesn't replace the current material or fix to a size that doesn't block my other material.
    I've gotten this far:
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    loadGallery();
    function loadGallery():void
    var l:Loader = new Loader();
    var req:URLRequest = new URLRequest("shortstack.swf");
    l.load(req);
    l.contentLoaderInfo.addEventListener(Event.INIT, galleryLoaded);
    function galleryLoaded(e:Event):void
    addChild(e.target.loader);
    What i want to do is load shortstack.swf into level 5, say, and fix it to the bottom left corner of the stage, and set its height to 400px and width to 980. 
    I have a an MC on the stage at those exact dimensions called placeholderMC, but I cannot figure out a way to target it, and the tutorials I've read have to do with loading on CLICK (I want it to load on enterFrame), and none of them tell me how to set parameters, as I could in old AS2.
    FWIW, AS3 may be more powerful, but AS2 was easier to understand.
    TIA,
    Jeff

    http://www.adobe.com/devnet/flash/quickstart/display_list_programming_as3.html

  • Invoking a function in a loaded swf file

    Hi,
    I have a SWF file which loads an additional SWF file, in the following method:
                var loader:Loader = new Loader();
                loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
                var request:URLRequest = new URLRequest(swf);
                loader.load(request);
    I want the parent (containing) SWF to call a "boot" function on the child SWF, so it will tell it what is the name of the LocalConnection that the parent is "connected" to. (The reason that the name of the LocalConnection is not fixed, is because I need to support multiple instances).
    Any ideas?
    TIA,
    Vince

    function onCompleteHandler(event:Event):void
         callLater(callBoot);
    Function callBoot():void
         Object(loader.content).boot();
    Note that you'll need to keep a reference to the loader in an instance variable and not a local variable
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

Maybe you are looking for

  • Dynamic path does not work in Css files

    Hi, I have a css file in which i have used few images, but when i try to make the path dynamic and include that css in my page the image doesn't appear but when i put the complete path in it it works. It works when used in this way : .inputrightbg   

  • OIA : Import Users, Accounts, User Role Memberships and Entitlements

    Hi, I have intgrated OIM 11.1.1.5 with OIA 11.1.1.5. I am trying to execute scheduled job in OIA " Import Users, Accounts, User Role Memberships and Entitlements" which in turn invokes scheduled job some of them are : OIM Staging Tables Collection St

  • Quiz publishing in Adobe Presenter

    Hi there, I am new to Adobe presenter, so still finding my way around. is there a way, when publishing quizzes to remove the sidebar? I don't want them to have the ability to search or look at the notes. Thanks.

  • How to Hide Maintenance Order Types

    Hi, I have created new order types ORD1 and ORD2 as copy of PM01, when I run IW31 and take F4 in order type field, then system shows me all the order types. Is there any possibility to hide standard order types PM01 - PM06 from front end order type f

  • Is there a way to download the update from OS X Leopard 10.5.8 to OS X Snow Leopard or do I need an install disc?

    I am trying to upgrade to Snow Leopard but I cannot figure out how to do it online. Do I actually need to purchase the disc and install it that way? Is there no way to download the update?