Trigger function when loaded swf finishes

I'm making a site that loads external swfs based on which
button is clicked. When the swf loads it plays an intro and then
stops at a certain point. My goal is that when you click another
button the current swf plays an outro before the next one loads.
The problem I'm having is making the outgoing movie trigger the
function that loads the next.
At first I tried just adding loadNextMovie(); to the last
frame of the loaded swf. But for some reason this causes the two
stops in the file from working so the thing just keeps looping. I
have no idea why adding this function call would prevent stop();
from working.
Is there another way to have the end of movie trigger the
function? Also, why doesn't adding loadNextMovie(); to the last
frame of the loaded swf work?

Ok, sure. I have main.swf that loads external.swf. Main.swf
has a function that loads a different movie. Like this:
function loadMovie():void {
trace("movie loaded")
This function is to be called from external.swf by putting
this in the last frame:
stop();
loadMovie();
But when I actually put loadMovie(); into external.swf the
stop no longer works and it just loops. What am I doing wrong? Is
trying to put this function call in the external swf the correct
approach?

Similar Messages

  • How do you work around code not functioning in loaded SWFs on iOS.

    Hi,
    I came across a post that suggested that in iOS, code does not function in loaded SWFs and a quick test demonstarted that this was true.  I'm just wondering if anyone has come up with a workaround for this.
    I'd appreciate any insight you can give me.
    Best,
    Chris

    Chris,
    The reason external SWFs with code in the doesn't work is that ADT cross-compiles your root SWF (and only your root swf) into objective-c code consumable by an iOS device.
    I created a workaround for this problem - as long as you embed your asset like this:
        [Embed(source="gameLevel.swf")]
          private var gameLevel:Class;
        addChild(new gameLevel());
    In this scenario, if gameLevel.swf has code in it, it typically wouldn't work in iOS, because new gameLevel() would create a Loader and interpret SWF bytecode.  But, if you first run the above SWF through my tool called SWFMerge, it will take your embedded SWF and merge it into your root SWF.  The result is that ADT will compile your code into objective-C, it will work on iOS, and note: new gameLevel() now results in an instance of your asset - NOT a Loader.
    The SWFMerge tool is here:
    http://www.onetacoshort.com/temp/SWFMerge_alpha.swf
    LMK if this workaround works for you or if you have trouble.  Cheers!
    -Jeff

  • [svn:osmf:] 15114: Don't check policy file when loading SWFs.

    Revision: 15114
    Revision: 15114
    Author:   [email protected]
    Date:     2010-03-29 12:24:58 -0700 (Mon, 29 Mar 2010)
    Log Message:
    Don't check policy file when loading SWFs.  Don't import local SWFs into current security domain.
    Modified Paths:
        osmf/trunk/framework/OSMF/org/osmf/elements/ImageLoader.as
        osmf/trunk/framework/OSMF/org/osmf/elements/SWFLoader.as
        osmf/trunk/framework/OSMF/org/osmf/elements/loaderClasses/LoaderUtils.as

    If you managed to get to the point where the applet container is created (the "gray square"), but the form never appears then you can assume one or more of the following has occurred:
    1. The JRE crashed after startup. Many times, but not always, if such a crash occurs it will leave a JRE dump file on the desktop. Its content may help to identify the cause.
    2. The Forms runtime crashed at startup. Many times, but not always, a Forms dump file will be created on the server. Its content may help to identify the cause.
    3. The Forms runtime was unable to start at all. This can occur on unix systems when/if there is a resource or permissions issue. One of the more common causes is if the file descriptor (nofiles) value is set too low.
    4. The applet is actually running, but has attempted to display a dialog box and is awaiting your acknowledgement, but the box was wrongfully sent to the background behind the browser. A similar issue was reported in one of the JRE 1.6.0_xx series, however I don't recall which one. Uninstall your current version and install the latest which is 1.6.0_27
    There are other possibilities, but these are most common.
    I would recommend the following:
    1. Uninstall any JRE older than 1.6.0_27. Reboot. Install 1.6.0_27
    2. Set networkRetries=5 in formsweb.cfg
    3. Set FORMS_TIMEOUT to 15 (default). Setting to a high value as you have is not recommended and is rarely necessary.
    4. Verify that the test form works. For example:
    http://machine:port/forms/frmservlet?form=test
    5. It appears that you are trying to use WU_TEST_106.fmx. Instead, download an updated version of this file (the name has also changed)
    http://www.oracle.com/ocom/groups/public/@otn/documents/webcontent/196249.zip
    6. Ensure that you have compiled webutil.pll into .plx. Do not use an old version of this file. The installation will include one. If not, check for it in an installation that also includes the Builders.

  • Can't Access MovieClips and Functions in Loaded SWF

    Hi everybody,
    I'm trying to simply access anything inside this loaded SWF and all I get is 'null'.
    I have code in the parent SWF that needs to tell the child SWF movieclip what to do but nothing works. This was a piee of cake in AS2 and I can't seem to get anything to crossover in AS3.
    Here's my code:
    import com.greensock.TweenMax;
    import flash.display.MovieClip;
    var myLoader:Loader = new Loader();
    var url:URLRequest = new URLRequest("SWCS_S3_500x250_exp_panel_2.swf"); // in this case both SWFs are in the same folder
    myLoader.load(url);  // load the SWF file
    panel2.addChild(myLoader);   // add that instance to the display list, adding it to the Stage at 0,0
    panel2 = myLoader.content as MovieClip;
    photo_about.alpha = 0;
    photo_downloads.alpha = 0;
    //panel2.content_about.alpha = 0;
    //panel2.content_downloads.alpha = 0;
    function closeSection():void
              panel2.controlsMC.forcePause();
              TweenMax.to(photo_about, .5, {alpha:0});
              TweenMax.to(photo_downloads, .5, {alpha:0});
              TweenMax.to(photo_home, .5, {alpha:0});
              TweenMax.to(panel2.content_about, .5, {alpha:0});
              TweenMax.to(panel2.content_downloads, .5, {alpha:0});
              TweenMax.to(panel2.controlsMC, .5, {autoAlpha:0});
              TweenMax.to(panel2.content_home, .5, {alpha:0});
    panel2 traces null and all the clips loaded within pull up undefined property errors.
    Can somebody please tell me what I'm doing wrong? I'd be stoked to know what I'm missing and feel like this should be a piece of cake.
    Thanks for any help!

    You are not adding the content to the stage at 0,0, you are adding it to panel2 at 0,0.  THen you take panel2 and assign it to be something that likely doesn't exist by the time you assign it.  You need to wait until the loader completes loading before you attempt to do anything with its content, otherwise it has no content (null).  Similarly, you cannot control anything in the loaded swf until it has finished loading.  So assign an event listener to the contentLoaderInfo property of the Loader to determine when loading is complete, and have the event handler function deal with starting the interaction with it.
    var myLoader:Loader = new Loader();
    var url:URLRequest = new URLRequest("SWCS_S3_500x250_exp_panel_2.swf");
    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, processLoadedSWF);
    myLoader.load(url);
    function processLoadedSWF(evt:Event):void {
        // deal with the loaded swf here
        // but you don't want to be assigning it to the panel2 object that contains the loader
    As far as controlling anything inside the swf you load, is it an AS1/2 or an AS3 swf?

  • Determining when Loader is finished loading

    How can I determine when myLoader has finished loading all
    the thumbnail images loaded into it using XML. The
    contentLoaderInfo 'complete' event fires every time an image is
    loaded in. I need to know when all the images have completely
    finished loaded. Ultimately I need to trace the 'height' property
    of myLoader's parent container_mc. I keep getting '0' as a result.
    Thank you!

    What I would do - is build your array of elements (push) an
    element on the array for every Image you have to load. Then all of
    your Image Loader COMPLETE events should be directed at one
    function. This function should just increment a counter. In this
    function it should then say if counter >= array.length then all
    is loaded and we can resize the element(s) or find out their real
    dimensions.

  • Memory leak when loading .swf in AS3?

    Hi all,
    I've got a pretty big issue here that I can't understand.
    I've got a pretty simple app that just repeatedly loads and then
    unloads an .swf called test.swf (this loaded .swf contains nothing
    but a document class and a graphic - a circle. The document class
    is blank, it just extends Sprite).
    When I set this class as the document class of a blank .swf,
    I trace the 'totalMemory' of the flash player, and load and unload
    the (very simple) clip over and over. You'd think that with garbage
    collection and all that, the memory would stay pretty
    constant...but no! It increases (and continues to for as long as
    I've run it!).
    I'm writing an application that loads and unloads many many
    .swf files, but it needs to have the smallest footprint
    possible...any ideas as to why the memory is never released?

    One idea - there is a separate stack of memory in the flash
    player where loaded classes in separate application domains exist,
    and these classes are not being garbage collected....however, there
    is a line in adobe's documentation here:
    http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Liv eDocs_Parts&file=00000327.html
    under "Usage C" :
    quote:
    Having a new application domain also allows you to unload all
    the class definitions for garbage collection, if you can ensure
    that you do not continue to have references to the child SWF.
    Given that, as far as I can see from this code, there is no
    reference to the loaded .swf maintained....it seems to me like the
    loaded data (graphical assets AND classes) should be garbage
    collected - but, while you WILL see a slight drop in memory after
    the removal of the SWF, the overall memory continues to increase
    the more you do it. Could Adobe be mistaken?

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

  • Error 1009 when loading swf?

    Hi
    I am trying to load an external swf (which references external files)
    everything seems to be fine only when i publish it i get error 1009
    Here is my code
    var swf:MovieClip;
    var loader:Loader = new Loader();
    var defaultSWF:URLRequest = new URLRequest("mainVideo/preview.swf");
    loader.load(defaultSWF);
    addChild(loader);
    The strange thing i that i followed this tutorial
    http://www.youtube.com/watch?v=8hAIW0ppDww
    and write the same code but i still get the error.
    I read about referencing external swf with referenced files, seems to be an issue with that, am i right?
    Thanks.

            public function videoplayer()       
                //set default values
                addEventListener(Event.ADDED_TO_STAGE,setDefaultValues);
                //read flashvars
                readFlashVars();
                //init video player
            //set default values function
            private function setDefaultValues(e:Event){
                //set scale properties
                stage.scaleMode=StageScaleMode.NO_SCALE;
                stage.align = StageAlign.TOP_LEFT;   
                //add fullscreen event to the stage
                stage.addEventListener(FullScreenEvent.FULL_SCREEN, fsEvent);
                stage.addEventListener(KeyboardEvent.KEY_UP, keyDownHandler);
                //set video url
                videoUrl = "videos/video1.flv";
                //set image url
                imageUrl = "image/image1.jpg";
                //set video height
                videoHeight = 320;
                //set video width
                videoWidth = 480;
                //set autoplay to false;
                autoplay = "false";           
                All_mc.videoHolder_mc.alpha = 0;
                All_mc.controls_mc.playPauseBut_mc.pause_mc.visible = false;
                All_mc.playPause_mc.pause_mc.visible = false;
                All_mc.controls_mc.playPauseBut_mc.pause_mc.over_mc.visible = false;
                All_mc.controls_mc.playPauseBut_mc.pause_mc.click_mc.visible = false;
                All_mc.controls_mc.playPauseBut_mc.play_mc.over_mc.visible = false;
                All_mc.controls_mc.playPauseBut_mc.play_mc.click_mc.visible = false;
                All_mc.controls_mc.fullscreenBut_mc.over_mc.visible = false;
                All_mc.controls_mc.fullscreenBut_mc.click_mc.visible = false;
                initPlayer();
                //make player visible
                All_mc.alpha = 1;
                //add buttons events
                addButtonsEvents();
                //load image
                loadImage();
                //load video
                loadVideo(true);
    MAKE SURE YOU HAVE THE video1.flv in a directory called videos and its relative to the swf.
    BR
    Murtuza
    http://www.sowebme.com/murtaza

  • CPU/Memory Usage increases when loading SWF files in AIR.

    Hi,
    We face the below mentioned problem. Would be great if someone could help us.
    Due to problems with uploading the attachment here, please send a email to the following email-id ([email protected]) and I shall send the attachment in response.
    CPU/Memory usage increases drastically while moving the SWC components and loading the SWF Files.
    "Problem Description" - On executing the sample application, a window with multiple objects is shown. The loaded SWC components in flex consume too much Memory and CPU cycles. This is visible in TaskManager. On dragging one of the object, CPU  / memory usage increases drastically.
    "Steps to Reproduce" -
    Draggable window is placed at the bottom in the sample application with Text indication.
    Drag the indicated window.
    "Actual Result" - System's CPU usage increasing drastically  around 50% to 60 %.
    "Expected Result" - Drastical increase in memory\CPU should not occur.
    "Any Workarounds" - No"
    Thanks in advance.

    You can control your external swf from your main.swf in the following method:
    loadswf(clips[0]);
    function loadswf(tmp:String):void{
        passedString=tmp;
        ldr= new Loader();
        ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);
        ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
        ldr.load(new URLRequest(animPath+tmp));
        function progressListener (e:ProgressEvent):void{
            ploader.visible=true;
        function swfLoaded(e:Event):void {
            mcExt = e.target.content as MovieClip;
            ldr.contentLoaderInfo.removeEventListener(Event.COMPLETE, swfLoaded);
            mcExt.addEventListener(Event.ENTER_FRAME,onEnterfn);
            ploader.visible=false;
            addChild(mcExt);
    function onEnterfn(e:Event):void{
        var num:int=mcExt.currentFrame;
        switch(passedString){
            case clips[0]:
                if (num==1) mcExt.play();
                if (num==9) {
                   mcExt.skipmc.addEventListener(MouseEvent.CLICK,skipfn);
                    function skipfn(e:MouseEvent):void{
                        mcExt.stop();
                       mcExt.removeEventListener(Event.ENTER_FRAME,onEnterfn);
                        gotoAndStop("help");
                if (num==mcExt.totalFrames){
                   mcExt.removeEventListener(Event.ENTER_FRAME,onEnterfn);
                    gotoAndStop("help");
                break;

  • Trigger function when variable a certain value?

    Hi
    I want a function to be triggered when a certain global var becomes true - I want to do this using an event listener.  I can do it as a one off using an if statement, but how do you set up a listener to trigger the function if the value becomes true at any time?
    Thanks guys
    Shaun

    Sorry kglad - I'm struggling to work this out.
    I've had a look at a few examples, but they don't make sense to me.
    I just want Flash to ....
    when globals.data.vari1 becomes true, gotoAndPlay(55);
    Could you please show me how this is done?
    Thanks in advance if you can help out.
    Cheers
    Shaun

  • Calling a parent function when child .swf closes

    I am adding a child .swf from the parent with a simple button. If this button is then clicked multiple times, the child is added multiple times. So I added the ".visible = false"  to the button when clicked so the button cannot be clicked while the child is open.
    Now, there is "Close" button on the child .swf that uses "this.parent.parent.removeChild(this.parent);" and would now need to set the parent button back to ".visible = true".
    I have tried MovieClip.parent.parent.resetButton();  and  parent as MovieClip.resetButton(); and many variations of the code. I get no errors but the code doesn't work either.
    Any ideas?
    Thank you.

    Figured this out on my own (don't believe it) without the child/parent communication.
    When the parent's button is clicked, I'm checking to see if the child already exists. If so, it won't create the child again.
    I'd still like to know how to perform the communication between child and parent.

  • How to stop trigger function when in post query?

    Hi All,
    I have a problem, not able to find the solution.
    I have created a form with 10 field items.
    For a field item called RECEIVED_15G, i have created a trigger:WHEN-VALIDATE-ITEM, it works fine as per my requirement.
    The problem is that i want this trigger to work only when i run the form , that when system is in NORMAL mode.
    I don't want this trigger to work after i do execute query, even here the system is in NORMAL mode.
    So how do i make it to work ??
    Is it possible to stop that trigger work after i click execute query (Something that i can code in Post query) ??
    Help me . Thank You.
    Oracle Forms 6i,
    Oracle DB 9i.

    Hi
    pls share with us the code my guess ; the When-Validate-Item (WVI) trigger is firing because you are setting a value in an item from post-Query Trigger>
    Note: just assign a name in a display item in post-query trigger DONT assign an id or any db item.
    Amatu Allah

  • Error #1014 when loading SWF in FlashPlayer 11.1 in Chrome

    Hi All
    Sorry if this is a basic question but I am struggling to understand the various answers I see posted on the web.
    I have developed a game using AS3 and AIR 3.7.
    Game runs fine in FlashDevelop but when I try and run the game in a browser using the Flash Player in Chrome I get an error #1014: Class flash.media::StageWebView could not be found.
    So my question is really two parts.
    1) Is it possible to configure Flash Player so that it can find the AIR libraries when playing my SWF in Chrome?
    2) As the StageWebView is the only class I am using from AIR is there an alternative in native Flash? I am using the control so that players can login using 3rd party verification such as FaceBook or Google
    Thanks in advance
    Steve

    It's a runtime error: referencing a mssing class in the A/S or XML. Perhaps you'd best ask in the Flash Pro forum.

  • Borwser crash when loading swf

    Hi all
    using Mac OSX. Safari, FireFox and Opera sometimes crash when
    opening this page:
    http://annetteberrydesign.com/index_content_new.php
    sometimes they don't crash... It seems random, but they often
    crash.
    There is something wrong with the swf for sure:
    the grey frame (grey lines) that draw at the beginning are
    not displaying properly, although they
    are displayed properly in authoring mode. (in authoring mode,
    two additional lines are drawn, but
    they are invisible in the published swf).
    The browsers started crashing when I changed the publish
    settings to flash version 8 (was previously
    flash version 6).
    I can't figure out why these lines are invisible in the
    published file, and why my browsers randomly
    crash when I open this page.
    Has anyone experienced this before?...
    seb ( [email protected])
    http://webtrans1.com | high-end web
    design
    An Ingenious WebSite Builder:
    http://sitelander.com

    Try creating a new user and opening it in that, just in case it is a something other than Pages causing the problem.
    Also try force opening the file with a text editor to get at the contents, you may be able to rescue something. A slim hope but worth trying.
    Also try getting at the parts of the file by going into Finder and right mouse clicking on the file and go +Show Package Contents+. Inside the package, if there is one, will be a Quicklook folder and inside that Preview.pdf.
    You can open the Preview.pdf in Preview and possibly copy material from that into another document to rescue it.
    You have learnt a painful lesson. If the material is vital keep the backup, especially as you were only working with the demo version of Pages 09.

  • Can you tell when a loaded SWF has reached its final frame?

    I used loadMovie to load an external SWF into the bottom-half
    of a main "shell" swf. When that loaded SWF finishes playing (it's
    just an animation), I need to populate a text field with the word
    "DONE" . The text field resides on the _root, so I need some way to
    know when the loaded SWF has reached its last frame...
    This would obviously be easy if I had the .FLA of the loaded
    SWF because I could just write the actionscript on the last frame
    of that SWF to populate the _root textfield. Alas, I do not have
    the source FLA of that loaded SWF, so I need some way to have the
    main "shell" SWF/FLA know when that loaded SWF has reached its end.
    Is this possible???
    Thanks!!!

    DIY_Lobotomy,
    > The reality of my situation is that there's a "menu" of
    sorts that
    > gets loaded into "contentClip". This "menu" has a bunch
    of links.
    So far, so good.
    > When clicked, each link loads a DIFFERENT swf into
    "contentClip".
    > It is THOSE swfs that I need to note the end of.
    That's still okay.
    > So, there's actually more than one, and they're not
    exactly being
    > loaded directly from my main movie, since they're
    actually loaded
    > based on a link being clicked in the movie that is
    currently loaded
    > into "containerClip"
    The concept is still the same, no matter what. No matter how
    deep the
    one-clip-loads-another chain goes, you have to keep taps on
    each chain link.
    When the final link has loaded, you'll be able to make your
    object reference
    to that movie clip. That movie clip -- because it's an
    instance of the
    MovieClip class -- will have the _currentframe and
    _totalframes properties.
    You'll just be checking *that* cliip's properties instead of
    the one named
    contentClip in my own example.
    You can loop using onEnterFrame or, if you prefer, with
    setInterva().
    That doesn't much matter either, so long as you repeatedly
    poll the deepest
    clip to test its current frame against its last frame (this
    all assumes that
    the clip being tested is a linear animation whose end
    corresponds to its
    last frame; otherwise, you could check _currentframe against
    any arbitrary
    frame number).
    > I hope that wasn't too confusing! Do you still have a
    solution???
    Not too confusing to understand, but it might be confusing
    to route
    through in practice. Not confusing, actually, but meticulous
    ... you'll
    have to be careful with your pathing. Nested movie clips are
    very much like
    nested folders on your hard drive. Their instance names
    relate to the
    folder names.
    Now, if that menu doesn't have an instance name you provided
    -- or if
    any fork along the path has an instance name you can't
    control -- you can
    still reference the nested movie clips. If you test your file
    in the
    Debugger panel, you'll see all the instances laid out in
    hierarchical order.
    You'll see that automatic instance names are provided
    (something like
    "instance1", "instance2", etc.).
    David Stiller
    Contributor, How to Cheat in Flash CS3
    http://tinyurl.com/2cp6na
    "Luck is the residue of good design."

Maybe you are looking for

  • Custom Error Message in Value Help

    Hi, In my application i have a Inputfield called "CLASS", for which i have added a value help..it has these values B    Business E    Economy F    First Class When the user enters a value(say "X") other than B, E, and F, it displays a message <b>Stri

  • How to syatem determine delivery date in sales order

    hi sap gurus how to syatem determine delivery date in sales order Thanks and regards ram

  • Mouse Hover text from FrameMaker to PDF

    Hello, I have a Terms list chapter in one of the book. I am trying to create a mouse over a highlighted term in the document to see its definition in the output PDF file. Is it possible for us to perform this operation in FrameMaker? Currently I am u

  • Parsing a string to a boolean array

    I got to pase a string to a boolean array, this code works for me, but I don't like it. Here Is public static boolean[] NumeroToBoolArray( int Numero ) //Here I got the number in Binary Format, then reverse it String temp = new StringBuffer(Integer.t

  • Changing an existing XML-File

    Hello everybody, is there any way to change an existing xml file (adding an xml element, for example), without copy the hole file? I've found kxml2 which can parse the xml files or build new xml files, but it doesn't support changing... Thank you Mic