AS in frame 1 of a linked swf executes, sometimes-

I’m using the loader class to load an external swf and attach it to an empty movie clip, the final step follows:
function loadComplete(e:Event):void {
     mc_launch.addChild(gLoader);
     MovieClip(gLoader.content).gotoAndPlay("start");
When navigating away from the movie clip, it’s dumped as follows:
MovieClip(gLoader.content).closeAllStreams();
gLoader.unload();
The linked swf has two important frames in the beginning. The first frame is labeled “hold” and has the following:
var gSC:SoundChannel = new SoundChannel();
var gSCBusy:Boolean = false;
var gSlideIndex:Number = 0;
var gAudioPosition:Number = 0;
var gPlayList:Array = ["start","slide01","slide02"]
var gAudioList:Array = ["intro.mp3","",""]
var gRunMode:String = Capabilities.playerType;
stop();
The fifth frame is labled “start” and the singing and dancing begins from there.
The stop(); function in the first frame is used to prevent the loading swf from executing before its 100% downloaded (I had some early trouble where the music would start before the screen assets were in place).
My problem: This works perfectly the first time the linked swf is downloaded and attached, however, if you navigate away and then back I get the error "gSlideIndex NAN" which indicates to me that the first frame in the linked swf is not executed on subsequent attachments, the playhead jumps straight to “start” and my globals are  never declared. Why would a linked swf execute frame 1 the first time it’s attached to mc_launch but not the second?

Update: Still not working, but some interesting behavior. I put the following two traces into frame 1 of the loaded swf:
trace("check point 1 " +this+" "+gSlideIndex);
var gSC:SoundChannel = new SoundChannel();
var gSCBusy:Boolean = false;
var gSlideIndex:Number = 0;
var gAudioPosition:Number = 0;
var gPlayList:Array = ["start","slide01","slide02"]
var gAudioList:Array = ["U2.mp3","",""]
var gRunMode:String = Capabilities.playerType;
trace("check point 2 " +this+" "+gSlideIndex);
stop();
On first play:
Check point 1 [movieclip object] NAN
Check point 2 [movieclip object] 0
On second play:
Nothing, the traces are skipped and gSlideIndex throws a NAN error when used in frame 10. I think it’s fairly clear frame 1 is not executing scripts on second play.
I have my doubts about this construct in the main timeline:
mc_launch.addChild(gLoader);
MovieClip(gLoader.content).gotoAndPlay("start");
What guarantee do I have that the loaded content has had time to execute frame 1 scripts before the next line in the main timeline bumps the play head to the start frame (frame 10)? … apparently none.
So here’s my noobish attempt at a work around. I divided the beginning of the loaded swf into three stages with frame labels mcInit, mcReady, and mcStart. mcInit initializes my globals and some other house keeping with NO stop(); … mcReady is 5 frames later with nothing but a stop(); mcStart is where the real media begins.
The main timeline attachement now looks like this:
var gMCReadyHold:Timer = new Timer(500,0);
mc_launch.addChild(gLoader);
MovieClip(gLoader.content).gotoAndPlay("mcInit");
gMCReadyHold.addEventListener(TimerEvent.TIMER,onStartMC);
gMCReadyHold.start();
function onStartMC(event:TimerEvent):void {
     var myFrame:String = MovieClip(gLoader.content).currentLabel;
     trace(myFrame);
     if (myFrame == "mcReady") {
          gMCReadyHold.removeEventListener(TimerEvent.TIMER,onStartMC);
          MovieClip(gLoader.content).gotoAndPlay("mcStart");
The idea is, have the main timeline explicitly force the loaded content to play frame 1 (mcInit), then check at 1/2 second intervals until the loaded content reports it’s reached the mcReady frame. Once the mcReady frame is reached, remove the timer and bump the play head in the loaded content to mcStart.
Problem 1: MovieClip(gLoader.content).gotoAndPlay("mcInit"); always throws a frame not found error (I’ve quadruple checked for silly spelling errors). OK, so maybe the loaded content hasn’t had time to establish the frame labels, I comment out that line and it plays fine the first time but on second play:
Problem 2: On second play the traces show the loaded content has reached mcReady but the traces on frame 1 are still not executing on second pass. This has got me really puzzled, I would think loading, attaching, and playing external an swf would be fairly routine and shouldn’t be this hard to control.
BTW: thanks for reading all of this.

Similar Messages

  • Linking swfs or exe files?

    I need help with a Flash AS3 project that includes about 30 videos. I needed to break it in smaller pieces because it is a large file (over 300 mb) and every time I wanted to publish the entire project flash crashed.
    Here is my test:
    I have two exe files that should link back and forth.
    Intro_YIM.exe, which has a button that links to Videos_FrontPage_YIM.exe
    Here is my code, which is in Intro (button name= nav_4).
    nav_4.addEventListener(MouseEvent.CLICK, gotoVideoFront);
    function gotoVideoFront(event:MouseEvent):void {
      var url:String = "Videos_FrontPage_YIM.exe";
      var request:URLRequest = new URLRequest(url);
      try {
        navigateToURL(request, '_self');
      } catch (e:Error) {
        trace("Error occurred!");
    Problem:
    The link seems to work, but there is a message that says save or run. When I click run, there is another message that says the file can't be open.
    Questions:
    1. Is there a better way to handle links using executable files using Flash CS5 and AS3?
    2. If swfs were used, how can I have a main page displaying all other swfs as they are linked?

    Kglad:
    Yes, initially I thought that exe files was the way to go. However, I've been searching for options and found that by using the class Loader, I can load swfs files instead of exe files.
    Here is what seems to work with only swf file:
    var my_loader:Loader = new Loader();
    nav_4.addEventListener(MouseEvent.CLICK, startLoading);
    function startLoading(e:MouseEvent):void {
        my_loader.load(new URLRequest("Videos_FrontPage_YIM.swf"));
        addChild(my_loader);
    Problem: I have a interface, which loads all other files by way of buttons. For instance, nav_4 button loads the file Videos_FrontPage.swf. When this movie loaded, the interface was also gone.
    How can I keep the same interface and still be able to load all other movies?
    Your help is appreciated.

  • Linking SWF to SWF

    Hey all,
    so i've just finished creating a flash advertisment for a
    college project, although i originally thought i would be linking
    file url's in order for the buttons within each swf to link to one
    another. however now i'm facing problems what i wish to do is link
    swf files to one another so they will open in the same window or
    "_self" e.g. "index.swf" links to "gallery.swf" through the
    gallery.mc or btn. can anyone help me out here. many thank:)

    (that's assuming that statement is on the main timeline of
    the current swf. otherwise, use
    _level0.loadMovie("gallery.swf");

  • Beginner - how to link swf to html

    Hi,
    I need help for :
    1) linking swf to html by a click of a button (example to skip the flash intro)
    and
    2) after swf finish playing I need it to go straight to a html page
    I tried several action code but it doesn't work... Can anyone help?

    enter_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    function mouseDownHandler(event:MouseEvent):void
        navigateToURL(new URLRequest("http://www.adobe.com"),"_self");
       navigateToURL(new URLRequest("hhttp://www.adobe.com","_self"));
    It's working fine just try the above code

  • Does hide a frame means do not run/execute that frame(and its query) ?

    Hi Everyone
    Does hide a frame means do not run/execute that frame(and its query) ?
    Thank you
    Bryan

    No. It means setting the Format Trigger of it to reurn FALSE, so it won't display.

  • Open swf on certain frame using HTML link

    Hi,
    I have an HTML page which I want to link to a flash movie.
    Within the HTML page there are 5 buttons, I want these 5 buttons to
    point to the same flash movie but to different points throughout
    the timeline of the movie.
    Can anyone tell me how to do this? is there a simple way of
    pointing to frame labels through the URL of the link?
    Thanks,

    I am quite new to this, the HTML for loading the SWF is as
    follows:
    <script type="text/javascript">
    AC_FL_RunContent( 'codebase','
    http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','na me','menu','width','968','height','208','align','middle','id','menu','src','Header?theGoTo Frame=86','quality','high','bgcolor','#FFFFFF','allowscriptaccess','sameDomain','pluginspa ge','http://www.macromedia.com/go/getflashplayer','movie','Header?theGoToFrame=86'
    ); //end AC code
    </script><noscript><object
    classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="
    http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
    name="menu" width="968" height="208" align="middle" id="menu">
    <param name="allowScriptAccess" value="sameDomain">
    <param name="movie" value="Header.swf?theGoToFrame=86">
    <param name="quality" value="high">
    <param name="bgcolor" value="#FFFFFF">
    <embed src="Header.swf?theGoToFrame=86" quality="high"
    bgcolor="#FFFFFF" width="968" height="208" name="menu"
    align="middle" allowScriptAccess="sameDomain"
    type="application/x-shockwave-flash" pluginspage="
    http://www.macromedia.com/go/getflashplayer">
    </object>
    Any help please :s

  • Query link not executing in Management Cockpit

    Hi,
    We have two types of Frame in the Management Cockpit namely Graphic and
    Reports and Links. The Graphic Frame is working fine.
    In the Frame Type-Reports and Links, we have added link of the
    query.However, when we try to execute this query from there, we
    get a popup as "Analyzer Message Popup" with the following messages:
    "Components D0LD7QSGDO27MCD613JJ04WLR (version A) do not exist on the
    database.
    The requested query/D0LD7QSGD027MCD613JJ04WLR does not exist on the
    current server.
    Unknown or deleted query"
    We are able to execute this query otherwise from analyzer or thru menu.
    Please advise.
    Regards,
    Ramesh

    user10887630 wrote:
    the second query is not returning rows at all................... So are you stating that the query never returns (i.e. it executes forever)? That it returns but the result set is not what you are expecting? Or something else?
    i mean that local ='en_us' is not there That sounds like you may be saying that the query returns but the results are not what you expect. Is that the case?
    Can you post the results of the query I posted?
    Justin

  • Going to a loaded frame in a loaded swf

    I've been successful to load a external swf using the loader.
    Lesson_mc is a movieclip I have on stage that I am loading the
    external swf. I have some masking that is there, that is why the
    movieclip. myLoader is a Load object. I can find the swf loaded
    using the debugger and see the currentLabel and Frame but when I
    try to get the information it sends a DisplayObject error. I have a
    Menu in the Main Window that controld the navigation. Getting to
    the frame on the first click works but trying to go to a frame
    within the same sef does not. Any thoughts?
    myRequest = new URLRequest("overview09.swf");
    myLoader = new Loader();
    myLoader.load(myRequest);
    addChild(myLoader);
    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    LessonLoad);
    function LessonLoad(evt:Event):void{
    trace("Lesson Loaded = ");
    Lesson_mc.addChild(myLoader);
    }//end function

    OTTOMH:
    don't you need the INIT event instead of the COMPLETE event?
    socalfish wrote:
    > I've been successful to load a external swf using the
    loader. Lesson_mc is a
    > movieclip I have on stage that I am loading the external
    swf. I have some
    > masking that is there, that is why the movieclip.
    myLoader is a Load object. I
    > can find the swf loaded using the debugger and see the
    currentLabel and Frame
    > but when I try to get the information it sends a
    DisplayObject error. I have a
    > Menu in the Main Window that controld the navigation.
    Getting to the frame on
    > the first click works but trying to go to a frame within
    the same sef does not.
    > Any thoughts?
    >
    > myRequest = new URLRequest("overview09.swf");
    > myLoader = new Loader();
    > myLoader.load(myRequest);
    > addChild(myLoader);
    >
    >
    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    LessonLoad);
    > function LessonLoad(evt:Event):void{
    > trace("Lesson Loaded = ");
    > Lesson_mc.addChild(myLoader);
    > }//end function
    >
    >

  • PDF in Frame - Open Web Link does not open in new window

    I actually have 2 problems.
    1. Acrobat 7.0.9. Added a link to open a web page. When the pdf is viewed from within a frame on a web page, the web page link in the pdf does not open in a new window but replaces the pdf in the frame.
    2. If I download the pdf to my workstation and open it and click on the link, it does open in a new window BUT opens up 2 browser windows where the 2nd one opened is blank (yes, I am single clicking on the link)
    Issue 1 occurs in both IE 6, IE 7 and Firefox ?.??
    Doug

    Try Ctrl-Y for preview.

  • Linking .swf to html page using a href ......

    I have attempted to get an anwser to this on the Flash forum, but it is a jungle over there.... I have attempted to link a swf to a web page on my site using the a href property; the page opens in Safari and Firefox; however, in IE7 the page shows at the bottom of the browser, but nothing happens on mousedown. I fear it may have to do with the way IE handles the wmode=transparent property...  I have tried using an invisible button in Flash, but it covers up the animation every time...
    This is the code for the two button graphics (movie clips):
    <table style="width: 100%;" border="0">
    <tbody>
    <tr>
    <td align="left"><a href="/index.php/design-samples.html">
    <object width="220" height="120" data="/Flash/designs_ad.swf" type="application/x-shockwave-flash">
    <param name="quality" value="best" />
    <param name="wmode" value="transparent" />
    <param name="src" value="/Flash/designs_ad.swf" />
    </object>
    </a></td>
    <td align="right"><a href="/index.php/recent-work.html">
    <object style="width: 220px; height: 120px;" width="220" height="120" data="/Flash/recentwork_ad.swf" type="application/x-shockwave-flash">
    <param name="quality" value="best" />
    <param name="wmode" value="transparent" />
    <param name="src" value="/Flash/recentwork_ad.swf" />
    </object>
    </a></td>
    </tr>
    </tbody>
    </table>

    Hi
    The reason it will not work in IE is because IE uses a different form of code to play swf's/flv's, (application vs's plug-in).
    Firefox and Safari use - type="application/x-shockwave-flash", but IE uses - classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000".
    If you do a standard insert - media - swf from the main menu bar in dreamweaver this will insert the correct code for you.
    PZ

  • Need to global find and scale and resize frame on a linked graphic

    I have a whole set of files that contain multiple instances of an icon set (placed AI file). All of these are formatted to flow in the text as anchored objects with various object styles. I need to make sure that all instances of the placed AI icons are scaled to 30% and that their frames are fit to content. I have a LOT of files and each one has at least 20 of these icons. I thought the Object find and replace would help, but unfortunately it will not let you search for links, and while I can search for the object styles, there's no option to change scale and the fit content options does not have the "fit frame to content" (and doesn't work anyway from the few tests I ran using "fit content proportionally"). 
    Does anyone have any ideas for how I can fix this globally in nearly 500 documents without having to manually select each icon and change the scale and apply the fit frame to content? I've done a handful of files this way, and it's VERY time consuming.

    First make sure this works by duplicating a file and testing.
    Make 1 image the size you need it
    Grep search for
    Find
    ~a
    Change to
    ~C
    if that doesn't work then try ~c (lower case) I can't remember how that works
    If it does work - then you can open 2 documents and choose "All Documents" in the Search field.
    If it's fine on 2 docs - then I'd say go ahead and do the rest.
    I stress to please use a duplicate set of files in case things go bad.

  • No FLV video in a linked SWF?

    I’ve got an FLV video linked to an external SWF (a substage) that is itself linked to another SWF (the main stage) The FLV plays fine if I publish and run the substage independently but when the substage is loaded into the main stage at runtime I lose the video, all the other screen elements from the substage work fine. I thought it might be a path issue so I hardcoded a fully qualified URL as the video source with the same results; works independently, fails when loaded into the main stage at run time. Anyone know what’s going on? Thanks.
    Flash CS5/AS3 using the video player component.

    The FLV is linked to tutorial.swf via the standard video playback component. The video and tutorial swf are in the same directory, optimally the video should be linked with a relative path but a fully qualified URL is an option.
    Tutorial.swf is loaded at runtime into the main swf using a standard loader class script. The main swf is in the parent directory of the tutorial & video directory (ie: it’s up one level).
    Tutorial.swf loads properly into the main swf and plays audio & animations, the only thing it doesn’t show is the video, no error is thrown.
    I’ve just discovered that I haven’t really tested the fully qualified URL option, my server didn’t have flv set as a valid mime type. If that works I’ll take it and move on, but I’d much rather a simple relative link.
    flv -(video playback component)-> tutorial.swf -(loader class script)-> main.swf

  • Poster Frame QT Movie linked to standard QT Movie loads in Firefox not I.E.

    Ok, this may be a rare question here. Here's what I've done following a small blurb of directions in iMovie6/iDVD the Missing Manual by David Pogue. (awesome book)
    I've created a "poster frame movie" in QT. This is a one -frame movie I use as the picture on the page.
    This poster frame movie, when clicked, is linked to a full version of the same movie that opens in the same place. The reason for this poster frame movie is to start the QT plug-in download as soon as someone reaches my page so there is no wait time when they click to watch the movie, it should be instantaneous.
    I tested this last night on my Mac with Firefox, and after clicking the poster frame movie (i.e.) the picture; the linked movie loaded right away. This worked on PC with Firefox as well.
    However, when this is page is loaded in Internet Explorer, on Mac or PC, the poster frame movie is there, but when clicked, the full movies do not load.
    Can anyone think of why or what setting I.E. may have that doesn't allow my QT movies to load when other browsers allow it?

    Yup, that's your problem.
    Before the <embed> you should add:
    <param name="href" value="http://blip.tv/file/get/Awarner20-AnniversarySecondTry745.mov">
    <param name="target" value="myself">
    As predicted, your problem is that while the QuickTime plug-in has the HREF and TARGET parameters, they are missing from your OBJECT code, meaning that the QuickTime ActiveX Control will never see them. You need to include all parameters in both places (unless you want different behavior in IE).
    Also, TECHNICALLY, you should also add a </embed> just before the </object>. The <embed> tag, like, for instance, the <p> tag is self-closing, but the most recent XML standard (HTML is a subset of XML) says, "Thou shalt close all of thy tags". So it won't make a bit of difference in function, but it is good practice. And yes, you should also close your <p> tags and use <br /> or <br></br>, too.
    (although technically we're not supposed to use EMBED at all anymore, as it isn't in the HTML spec, but it works with all browsers except IE while OBJECT doesn't always...)
    --Dave Althoff, Jr.

  • How to access frame labels in a SWF loader?

    I have a swfloader, which has a swf file embedded.  It loads and plays, and stops at the frame in the swf where I have a stop().
    In one of my app's functions, I need to send the playhead in the swf to another frame labe, but I seem to have forgotten how to talk to the swf.
    <mx:SWFLoader source="@Embed(source='assets/thermal.swf')" id="diagram" />
    diagram.gotoAndPlay("myLabel"); does not compile.
    I know this is simple, but I can't find it anywhere...

    I tried this:
                        import flash.display.MovieClip;
              protected function accordion1_changeHandler(event:IndexChangedEvent):void {
                        var mc:MovieClip = diagram.content as MovieClip;
                        switch (event.currentTarget.selectedIndex) {
                             case 0:
                                  currentState = "phase1";
                                  mc.play();
                                  break;
                             case 1:
                                  currentState = "phase2";
                                  mc.gotoAndPlay("start2");
                                  diagram
                                  break;
                             case 2:
                                  currentState = "phase3";
                                  break;

  • Dashboard Builder - sequencing the load order of content linked swfs?

    Hi,
    I don't think this is possible but wanted to throw it out there and see if anybody has some cunning tips on this subject...
    We have an InfoView Dashboard that houses 5 Xcelsius modules (swfs). There is a Header Sidebar (swf) that initialises and passes parms to 4 chart modules (swfs) using content linking. Everything works fine and as the selections in the header change, new parms are sent to the swfs which in turn change correctly.
    The issue we have is that the business would like everything to initialise with a starting view that contains data. This is not currently done because we cannot guarantee the order that the swfs load in and the 4 chart modules are dependant on the header. The user has to press refresh at the start to trigger the experience once the header has fully loaded.
    I'm going to play around with it and will report back with my findings but if anybody has a technique for ensuring child modules are loaded automatically on load AFTER the parent module has gotten its data back and passed the content linked parms, please let me know. Or if there is a way to order (or daisychain) the loading of modules please share this.
    Cheers,
    Lee

    Hi Tracy thanks for your replies.  I found somebody to help me on getacoder.com - this code works perfectly.
    The flex code:
    <mx:Script>
    <![CDATA[
    public function FromSwf1(value:String):void
    swfLoader.source = value;
    public function FromSwf2(value:String):void
    swfTeacher.source = value;
    ]]>
    </mx:Script>
    The AS3 code:
    var flexApp = root.parent.parent['parentApplication'];
    btn1.addEventListener(MouseEvent.CLICK, CallFlexFunction);
    //stage.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);
    function CallFlexFunction(e:MouseEvent) {
    flexApp.FromSwf1("assets/ninos/alphabet.swf");
    btn2.addEventListener(MouseEvent.CLICK, CallFlexFunction2);
    //stage.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);
    function CallFlexFunction2(e:MouseEvent) {
    flexApp.FromSwf2("assets/ninos/clase_de_ninos.swf");

Maybe you are looking for

  • Cost center change

    we want to change cost center right now, I'm concerned about the PO and fixed asset with those old cost center, may I know the table for PO, fixed asset assignment? for the open PO(done goods receipt, but not invoice verification), PO(done both GR an

  • Active Directory - Forte/UDS integration

    Does any body integrated Active Directory Server with Forte ? We are trying to integrate Forte with Active Directory Server. Our first step is to open a session on Active Directory from Forte and that was successful. The second step is to bind to the

  • Monitoring Queues

    Hello all! I have been following some documentation to set up monitoring and alert framework with CCMS in XI.  One question I have is what is the best way to monitor queues that have built up and aren't sending.  Once queues reach a certain point, is

  • ICloud/iPad photo resolution

    My iPad / iCloud settings are to store the higher quality original photo in iCloud while the iPad automatically, in the background, makes a second smaller version for local storage optimised for the iPad. This is a setting on the iPad. Does this func

  • AFS Material Indicator in ME23N

    Hello, I have a technical requirement where I'm creating a PO using ABAP object class in a program. However, I find that the AFS material indicator in the item data is not ticked. I wish to know what are the criteria on when this indicator is marked.