External .swf Intro ActionScript Problem

I have used a loader component to load to an external .swf
file (an intro animation). Once the external movie finishes playing
I want my parent movie to move to a certain frame on my parent
timeline. Nothing I try seems to work.

So I could use the code that you provided in the timeline of
the intro movie that I am loading into my main timeline?

Similar Messages

  • Will app store approve an app to load external swf containing actionscript code in it?

    Will app store approve an app to load external swf containing actionscript code in it?

    Hi...It is not in the application bundle...it will be hosted on a server and from there it will be loaded in the application. I had created one sample application where it is loading a swf which is hosted on different server. This swf contained some actionscript code on its timeline. This app was working on ipad. I just wanted to know whether App Store will approve this.

  • Preloader ignores external swf's actionscript

    Hey guys
    I have an External.swf file that is a video. The swf is 1135 frames long and running just fine by itself, stopping as I want when the actionscript says stop(); on the first frame and looping the end of the clip with gotoAndPlay(837).
    The preloader SwfLoader.swf linked to the External.swf shows the percentage of bytes loaded as it should. However, it runs the video (sound playing in the background) while the preloader shows the loading progress I think it's because it doesn't load the first frame first.
    Once the external swf is loaded, it plays the video again, still ignoring the first actionscript frame that says stop(); and the last frame gotoAndPlay(837).
    Thank you.
    Here is the preloader's actionscript on the first and only frame:
    import flash.geom.*
    import flash.display.*
    var loadurl:String = "External.swf";
    var nDepth:Number = 0;
    var nWidth:Number = 200;
    var nHeight:Number = 20;
    var nPadding:Number = 3;
    var cLoader:MovieClipLoader = new MovieClipLoader();
    var oListener:Object = {onLoadInit:onContentLoaded};
    var mcLoader:MovieClip = this.createEmptyMovieClip("Loader_MC", 0);
    var mcContent:MovieClip = this.createEmptyMovieClip("Content_MC", 1);
    var mcLoadBarBg:MovieClip = mcLoader.createEmptyMovieClip("LoadBarBg_MC", nDepth++);
    var mcLoadBar:MovieClip = null; //Duplicated later with mcLoadBarBg
    var txtPercLoad:TextField = null; //Create after duplication
    var cMatrix:Matrix = new Matrix();
    mcLoader._alpha = 0;
    cMatrix.createGradientBox(nWidth, nHeight, 0, nPadding, nPadding);
    cLoader.addListener(oListener);
    mcLoader.lineStyle(1, 0x000066, 100);
    DrawRect(mcLoader, 0, 0, nWidth, nHeight);
    mcLoadBarBg.lineStyle(1, 0x0000FF, 0);
    mcLoadBarBg.beginGradientFill("linear", [0x006699, 0x0066FF], [100,100], [0, 255], cMatrix, SpreadMethod.PAD);
    DrawRect(mcLoadBarBg, 0, 0, nWidth - nPadding*2, nHeight - nPadding*2);
    mcLoadBarBg.endFill();
    mcLoadBar = mcLoadBarBg.duplicateMovieClip("LoadBar_MC", nDepth++);
    txtPercLoad = mcLoader.createTextField("PercLoad_TXT", nDepth++, 0, 0, nWidth, nHeight);
    mcLoadBar._alpha = 80;
    mcLoadBarBg._alpha = 30;
    Translate(mcTextMask, nPadding, nPadding);
    Translate(mcLoadBarBg, nPadding, nPadding);
    Translate(mcLoadBar, nPadding, nPadding);
    mcLoadBar._xscale = 0;
    mcContent._alpha = 0;
    mcContent._lockroot = true;
    mcLoader._x = Stage.width/2 - mcLoader._width/2;
    mcLoader._y = Stage.height/2 - mcLoader._height/2;
    txtPercLoad._x = mcLoader._width/2 - txtPercLoad._width/2;
    txtPercLoad._y = mcLoader._height/2 - txtPercLoad._height/2;
    SetTextFormat(txtPercLoad, "0%");
    mcLoader._alpha = 100;
    cLoader.loadClip(loadurl, mcContent);
    _root.onEnterFrame = function()
       var nBytesLoaded:Number = mcContent.getBytesLoaded();
       var nBytesTotal:Number = mcContent.getBytesTotal();
       var nPercLoaded:Number = Math.round(nBytesLoaded / nBytesTotal * 100);
       if(nPercLoaded > 0)
          SetTextFormat(txtPercLoad, nPercLoaded.toString() + "%");
                mcLoadBar._xscale = nPercLoaded;
    function onContentLoaded(Void):Void
       //trace(_root + "::onContentLoaded");
       SetTextFormat(txtPercLoad, "100%");
       cLoader.removeListener(oListener);
       delete _root.onEnterFrame;
       delete oListener;
       delete cLoader;
       _root.onEnterFrame = function()
          //trace(_root + "::onContentLoaded::_root.onEnterFrame");
                var nInc:Number = 5;
                mcLoader._alpha -= nInc;
                mcContent._alpha += nInc;
                if(mcLoader._alpha <= 0) startLoadedContent();
    function startLoadedContent(Void):Void
       delete _root.onEnterFrame;
       mcLoader.removeMovieClip();
       mcContent._alpha = 100;
       mcContent.play();
    function DrawRect(mc:MovieClip, nX:Number, nY:Number, nW:Number, nH:Number, nR:Number)
       trace("DrawRect in: " + mc);
       if(nR == undefined) nR = 6;
       mc.moveTo(nX+nR,nY);
       mc.lineTo(nX+nW-nR,nY);
       mc.curveTo(nX+nW,nY,nX+nW,nY+nR);
       mc.lineTo(nX+nW,nY+nH-nR);
       mc.curveTo(nX+nW,nY+nH,nX+nW-nR,nY+nH);
       mc.lineTo(nX+nR,nY+nH);
       mc.curveTo(nX,nY+nH,nX,nY+nH-nR);
       mc.lineTo(nX,nY+nR);
       mc.curveTo(nX,nY,nX+nR,nY);
    function SetTextFormat(txtField:TextField, sText:String)
       var txtFmt:TextFormat = new TextFormat();
       sText = "Loading... " + sText;
       txtFmt.font = "Verdana";
       txtFmt.align = "center";
       txtFmt.size = 11;
       txtFmt.color = 0x000066;
       txtFmt.bold = true;
       txtField.selectable = false;
       txtField.text = sText;
       txtField.setTextFormat(txtFmt);
       txtFmt = null;
    function Translate(mc:MovieClip, nX:Number, nY:Number):Void
       mc._x = nX;
       mc._y = nY;

    Hi kglad,
    The external swf is a movieclip (flv embedded with an AS3 layer to control the timeline) exported as an swf file .
    The first frame of the external swf is just stop();
    I didn't know the proloader code was AS2 though
    The preloader works fine with the external swf locally, but the problem happens when I run them from my server.
    The external swf itself and its code works fine from the server, both combined don't, so I guess the problem comes from the preloader. Probably because of the AS being 2 insted of 3.

  • Loading external SWF in Actionscript 2

    I am creating an animation within Flash CS4 in Actionscript 2.0 / Flash Player 7
    At the moment I have a handler (Movie Clip) called myHolder that is used to play other swf files within one main swf file, when called by a button
    Within a button that load the swf into the main timeline - For Example
    on (press) { loadMovie("BulletTrainDRAFT.swf", myHolder); }
    This works fine with bring other swf files into the main swf file timeline, but when I bring a swf file that has video controls for a video within it, they do not respond within the handler when played, but they do work when that swf file is played within its own external flash player window (The video is within a (Movie Clip) on its own timeline within its design fla)
    Video buttons - ActionScript 2.0
    btnStop.onPress = function(){  _root.vid.stop();  } btnPlay.onPress = function(){  _root.vid.play();  }  btn_fastforward.onPress = function(){  _root.vid.nextFrame();  }  btn_Rewind.onPress = function(){  _root.vid.prevFrame();  }
    I tried ActionScript 3.0 code as well
    Pausebtn.addEventListener(MouseEvent.CLICK,pauseHandler); Stopbtn.addEventListener(MouseEvent.CLICK, stopHandler); Playbtn.addEventListener(MouseEvent.CLICK,playHandler); 
    function stopHandler(event:MouseEvent):void { // Pause the stream and move the playhead back to // the beginning of the stream. video.gotoAndStop(1); } function playHandler(event:MouseEvent):void { // Pause the stream and move the playhead back to // the beginning of the stream. video.play(); } function pauseHandler(event:MouseEvent):void { // Pause the stream and move the playhead back to // the beginning of the stream. video.stop(); }
    Problem I have I think, is that a movie the external swf loads on the existing timeline as a child and doesn't unload the timeline resulting the actionscript not functional, but I can't fix this.

    if the loaded swf with video is an as2 swf, add:
    this._lockroot=true
    to it's main timeline.

  • AS3 Unloading external SWF piling up problem

    I have two buttons on main SWF what loads and Unload two external SWFs back and forth.
    Also one timer function is calling external Screen saver SWF and unload the existing one when no interaction found.
    I am using unloadAndStop() function to unload the external SWFs.
    But after loading and unloading external SWFs, I am facing piling up or stack overflow problem.
    Any help will be highly appreciated.
    Thanks
    import flash.net.NetConnection;
    import flash.net.NetStream;
    import flash.media.Video;
    import flash.display.MovieClip;
    import caurina.transitions.*;
    import flash.utils.Timer;
    import flash.events.*;
    var myLoader_Map_1:Loader = new Loader();
    var myLoader_Map_2:Loader = new Loader();
    var myLoader_Screen_Saver:Loader = new Loader();
    var Ss:Boolean = false;
    var Maps:Boolean = true;
    //--------------------Screen Saver---------------------------------
    ScreenSaver();
      function ScreenSaver():void{
      var url:URLRequest = new URLRequest("screensaver.swf");
      myLoader_Screen_Saver.load(url); 
      addChild(myLoader_Screen_Saver);
      setChildIndex(myLoader_Screen_Saver, 1);
      Maps = false;
      Ss = true;
      function ScreenSaver_Unload():void{
      myLoader_Screen_Saver.unloadAndStop();
    //--------------------Map Buttons---------------------------------
    function MPstart():void{
      Tweener.addTween(MC_Maps_Btns,{alpha:1, x:778.25, y:1070.65, time:1, delay:1, transition:"easeOutCubic"});
      setChildIndex(MC_Maps_Btns, 2);
      MC_Maps_Btns.Btn_Map_1.visible = true;
      MC_Maps_Btns.Btn_Map_2.visible = true;
    function MPclose():void{
      Tweener.addTween(MC_Maps_Btns,{alpha:0, x:778.25, y:1179.85, time:1, transition:"easeOutCubic"});
    //--------------------Map 1 ---------------------------------
    MC_Maps_Btns.Btn_Map_1.addEventListener(MouseEvent.CLICK,OpenMap1);
      function OpenMap1(e:MouseEvent):void{
      var url:URLRequest = new URLRequest("Map_1.swf");
      myLoader_Map_1.load(url);
      myLoader_Map_1.alpha = 1;
      addChild(myLoader_Map_1);
      setChildIndex(myLoader_Map_1, 2);
      myLoader_Map_2.unloadAndStop();
      ScreenSaver_Unload();
      Maps = true;
      Ss = false;
      MC_Maps_Btns.Btn_Map_1.visible = false;
      MC_Maps_Btns.Btn_Map_2.visible = true;
    //--------------------Map 1 ---------------------------------
    MC_Maps_Btns.Btn_Map_2.addEventListener(MouseEvent.CLICK,OpenMap2);
      function OpenMap2(e:MouseEvent):void {
      var url:URLRequest = new URLRequest("Map_2.swf");
      myLoader_Map_2.load(url);
      myLoader_Map_2.alpha = 1;
      addChild(myLoader_Map_2);
      setChildIndex(myLoader_Map_2, 2);
      myLoader_Map_1.unloadAndStop();
      ScreenSaver_Unload();
      Maps = true;
      Ss = false;
      MC_Maps_Btns.Btn_Map_2.visible = false;
      MC_Maps_Btns.Btn_Map_1.visible = true;
    //--------------------Timer ---------------------------------
    var inactiveTime:int = 10000;
    var t:Timer = new Timer(inactiveTime);
    stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown1);
    t.addEventListener(TimerEvent.TIMER, onTimer);
    t.start();
      function onMouseDown1(e:MouseEvent):void {
      t.reset();
      t.start();
      trace("Interaction detected");
      function onTimer(e:TimerEvent):void {
      handleInactivity();
      function handleInactivity():void {
      trace('You\'re inactive.');
      if (Maps == true){
      myLoader_Map_1.unloadAndStop();
      myLoader_Map_2.unloadAndStop();
      else{
      trace("No Maps");
      if (Ss == false ){
      ScreenSaver();
      MPclose();
      else{
      trace("ScreenSaver already loaded");

    This is how I applied
    import flash.net.NetConnection;
    import flash.net.NetStream;
    import flash.media.Video;
    import flash.display.MovieClip;
    import caurina.transitions.*;
    import flash.utils.Timer;
    import flash.events.*;
    var myLoader_Map_1:Loader = new Loader();
    var myLoader_Map_2:Loader = new Loader();
    var myLoader_Screen_Saver:Loader = new Loader();
    var Ss:Boolean = false;
    var Maps:Boolean = true;
    //--------------------Screen Saver---------------------------------
    function unloadAllF():void{
    if(myLoader_Screen_Saver.content){
    myLoader_Screen_Saver.unloadAndStop();
    trace("ss unloaded");
    if(myLoader_Map_1.content){
    myLoader_Map_1.unloadAndStop();
    trace("map_1 unloaded");
    if(myLoader_Map_2.content){
    myLoader_Map_2.unloadAndStop();
    trace("map_2 unloaded");
    //etc
    ScreenSaver();
      function ScreenSaver():void{
      var url_ss:URLRequest = new URLRequest("screensaver.swf");
      unloadAllF();
      myLoader_Screen_Saver.load(url_ss); 
      addChild(myLoader_Screen_Saver);
      setChildIndex(myLoader_Screen_Saver, 1);
      Maps = false;
      Ss = true;
        function ScreenSaver_Unload():void{
      myLoader_Screen_Saver.unloadAndStop();
    //--------------------Map Buttons---------------------------------
    function MPstart():void{
      Tweener.addTween(MC_Maps_Btns,{alpha:1, x:778.25, y:1070.65, time:1, delay:1, transition:"easeOutCubic"});
      setChildIndex(MC_Maps_Btns, 2);
      MC_Maps_Btns.Btn_Map_1.visible = true;
      MC_Maps_Btns.Btn_Map_2.visible = true;
    function MPclose():void{
      Tweener.addTween(MC_Maps_Btns,{alpha:0, x:778.25, y:1179.85, time:1, transition:"easeOutCubic"});
    //--------------------Map 1 ---------------------------------
    MC_Maps_Btns.Btn_Map_1.addEventListener(MouseEvent.CLICK,OpenMap1);
      function OpenMap1(e:MouseEvent):void{
      var url_map_1:URLRequest = new URLRequest("Map_1.swf");
      unloadAllF();
      myLoader_Map_1.load(url_map_1);
      myLoader_Map_1.alpha = 1;
      addChild(myLoader_Map_1);
      setChildIndex(myLoader_Map_1, 2);
      myLoader_Map_2.unloadAndStop();
      ScreenSaver_Unload();
      Maps = true;
      Ss = false;
      MC_Maps_Btns.Btn_Map_1.visible = false;
      MC_Maps_Btns.Btn_Map_2.visible = true;
    //--------------------Map 1 ---------------------------------
    MC_Maps_Btns.Btn_Map_2.addEventListener(MouseEvent.CLICK,OpenMap2);
      function OpenMap2(e:MouseEvent):void {
      var url_map_2:URLRequest = new URLRequest("Map_2.swf");
      unloadAllF();
      myLoader_Map_2.load(url_map_2);
      myLoader_Map_2.alpha = 1;
      addChild(myLoader_Map_2);
      setChildIndex(myLoader_Map_2, 2);
      myLoader_Map_1.unloadAndStop();
      ScreenSaver_Unload();
      Maps = true;
      Ss = false;
      MC_Maps_Btns.Btn_Map_2.visible = false;
      MC_Maps_Btns.Btn_Map_1.visible = true;
    //--------------------Timer ---------------------------------
    var inactiveTime:int = 10000;
    var t:Timer = new Timer(inactiveTime);
    stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown1);
    t.addEventListener(TimerEvent.TIMER, onTimer);
    t.start();
      function onMouseDown1(e:MouseEvent):void {
      t.reset();
      t.start();
      trace("Interaction detected");
      function onTimer(e:TimerEvent):void {
      handleInactivity();
      function handleInactivity():void {
      trace('You\'re inactive.');
      if (Maps == true){
      myLoader_Map_1.unloadAndStop();
      myLoader_Map_2.unloadAndStop();
      else{
      trace("No Maps");
      if (Ss == false ){
      ScreenSaver();
      MPclose();
      else{
      trace("ScreenSaver already loaded");

  • External SWF file load problem

    I'm loading external SWF file which has motion tween.After
    the loading progress bar finished to load than calls SWF file.If I
    test the movie locally works fine but when simulate the download it
    seems it jumps end of the timeline.Is anyone could tell me why is
    this??
    Thanks

    k, never mind..... finally figured it all out.

  • Loading an external swf and unloading the parent one

    Hi there i have made a navigation in flash and 3 buttons that load some external swf's. Problem is that when they load the parent swf keeps playing in the background. How can i make them play separately and make the navigation stage dissapear completely when they load?

    I have attempted to use the same Loader but it doesnt replace it i dont know why.
    var myLoader:Loader = new Loader();       
    var myLoaderMain:URLRequest = new URLRequest("main1.swf");
    var myLoaderQuiz:URLRequest = new URLRequest("quiz.swf");
    var myLoaderAnimation:URLRequest = new URLRequest("athens_animation.swf");
    var myLoaderVideo:URLRequest = new URLRequest("videogallery.swf");
    videogallerybtn.addEventListener(MouseEvent.CLICK, videoFunc);
    function videoFunc(curEvt:MouseEvent) {
              myLoader.load(myLoaderVideo);
              addChild(myLoader);
    Quizbtn.addEventListener(MouseEvent.CLICK, quizFunc);
    function quizFunc(curEvt:MouseEvent) {
              myLoader.load(myLoaderQuiz);
              addChild(myLoader);
    Animationbtn.addEventListener(MouseEvent.CLICK, AnimationFunc);
    function AnimationFunc(curEvt:MouseEvent) {
              myLoader.load(myLoaderAnimation);
              addChild(myLoader);

  • Transition_Manager and unloading external swf problems

    Hi there
    I´m having a few problems with my project which i although it work it has some unpleasant bugs that i´m trying to solve for days.
    When i load external swf´s they show up on top of the Menu button.Maybe because the button i´m pressing is inside the same movieclip as the Menu.
    Explaining better here´s a little diagram of my site:
    con2 MC (Instance of Menu) ---> cont3 MC (Instance of subMenu) and mainButton MC (Instance of Main)
    Here´s the general code which is inside the Painel.as
    package {
        import com.greensock.TweenLite;
        import com.greensock.TweenMax;
        import com.greensock.*;
        import com.greensock.easing.*;
        import flash.display.*;
        import flash.events.*;
        import flash.display.MovieClip;
        import fl.transitions.*;
        import fl.transitions.easing.*;
        import flash.net.URLRequest;
        import flash.display.Loader;
        import flash.events.Event;
        import flash.events.ProgressEvent;
        public class Painel3 extends MovieClip
            private var inFocus:MovieClip;
            public function Painel3():void
                setupClips();
                addEventListener(Event.ENTER_FRAME, loop);
            private function setupClips():void
            con2.mainButton.addEventListener(MouseEvent.ROLL_OVER, onOver);
            con2.mainButton.addEventListener(MouseEvent.ROLL_OUT, onOut);
            con2.mainButton.addEventListener(MouseEvent.CLICK, onClick);
                var len:int = con2.cont3.numChildren;
                for(var i:int=0; i<len; i++)
                    var mc:MovieClip = MovieClip(con2.cont3.getChildAt(i));
                    mc.buttonMode = true;
                    mc.loc = [mc.x, mc.y];
                    mc.addEventListener(MouseEvent.CLICK, onClick);
                    con2.cont3.visible = false;
            private function onOver(e:MouseEvent):void
            private function onOut(e:MouseEvent):void
            private function onClick(e:MouseEvent):void
                con2.cont3.visible = true;
    TransitionManager.start(con2.cont3, {type:Wipe, direction:Transition.IN, duration:1, easing:None.easeNone, startPoint:5} );                       
            private function loop(e:Event):void
                var distx:Number = mouseX / 1400;
                var disty:Number = mouseY / 1400;
                TweenLite.to(con2, 2, {
                            rotationY:(-70 +(145*distx)),
                            rotationX:(70 -(145*disty)),
                            ease:Expo.easeOut
    And then inside the subMenu.as class for the movieclip subMenu i have the buttons that load the external swf´s:
    package  {
        import com.greensock.TweenLite;
        import com.greensock.TweenMax;
        import com.greensock.*;
        import com.greensock.easing.*;
        import flash.display.*;
        import flash.events.*;
        import flash.display.MovieClip;
        import flash.net.URLRequest;
        import flash.display.Loader;
        import flash.events.Event;
        import flash.events.ProgressEvent;
        import fl.transitions.*;
        import fl.transitions.easing.*;
        public class subMenu extends MovieClip {
            public function subMenu() {
                // constructor code
                menu1.buttonMode = true;
                menu2.buttonMode = true;
                menu3.buttonMode = true;
                menu4.buttonMode = true;
                 menu1.addEventListener(MouseEvent.CLICK,link1);
                 menu2.addEventListener(MouseEvent.CLICK,link2);
                 menu3.addEventListener(MouseEvent.CLICK,link3);
                 menu4.addEventListener(MouseEvent.CLICK,link4);
            function link1(e:MouseEvent) {
               function startLoad()
                var mLoader:Loader = new Loader();
                var mRequest:URLRequest = new URLRequest("AugmentedReality_v1.swf");
                mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
                mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
                mLoader.load(mRequest);
    function onCompleteHandler(e:Event):void {
    var swf:DisplayObject = e.target.content;
    swf.x = -400;    
    swf.y = -300;    
    addChild(swf);
    function onProgressHandler(mProgress:ProgressEvent)
           var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
           trace(percent);
    startLoad();
            function link2(e:MouseEvent) {
                function startLoad()
                var mLoader:Loader = new Loader();
                var mRequest:URLRequest = new URLRequest("Fotos.swf");
                mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
                mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
                mLoader.load(mRequest);
    function onCompleteHandler(e:Event):void {
    var swf:DisplayObject = e.target.content;
    swf.x = -400;    
    swf.y = -300;    
    addChild(swf);
    function onProgressHandler(mProgress:ProgressEvent)
           var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
           trace(percent);
    startLoad();
            function link3(e:MouseEvent) {
            function link4(e:MouseEvent){
                function startLoad()
                var mLoader:Loader = new Loader();
                var mRequest:URLRequest = new URLRequest("Texto.swf");
                mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
                mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
                mLoader.load(mRequest);
    function onCompleteHandler(e:Event):void {
    var swf:DisplayObject = e.target.content;
    swf.x = -400;    
    swf.y = -300;    
    addChild(swf);
    function onProgressHandler(mProgress:ProgressEvent)
           var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
           trace(percent);
    startLoad();
    Like i said the swf´s show up on top of the Menu and i need it to dissapear.
    Also i want to unload the swf currently in scene so that when i load another one they don´t pile on top of each other.
    Pls help. Thanks

    Oh btw, i´m having an error 1069 Property TransitionManager not found in subMenu and there is no default value
    at fl.transitions::TransitionManager$/start()
        at Painel3/onClick()
    This doesn´t happen when i uncheck the Export for actionscript in the subMenu class but i can´t do that or else the buttons wont work.

  • HELP PLEASE - loading external swf scale problem

    I have a Flex 3 Actionscript Project. Basically all it does it take some flash vars, set the sound volume,  and load an external swf using a loader and add the loader as a child. The problem is I want the loaded external swf to be scaled to fill the entire stage, even if it distorts it, and that doesn't seem to be happening.
    I really need to resolve this. ANY HELP APPRECIATED.
    Marcus

    Thanks for the reply!
    Here's basically what my code looks like (note: I cut some stuff out that wasn't relevant for the sake of clarity).
    private var swfLoader:Loader = null;
    public function MySwfContainer()  
        stage.scaleMode = StageScaleMode.EXACT_FIT;
        stage.align = StageAlign.TOP_LEFT;
        var request:URLRequest = new URLRequest(swfUrl);
        swfLoader = new Loader();
        swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,SWFLoader_Complete);
        swfLoader.load(request);       
    private function SWFLoader_Complete(event:Event):void
        addChild(swfLoader);
    What I am observing is that if a swf larger than the stage area is loaded it clips it rather than scale it down and make it fit.
    Marcus

  • Runnng external swf Actionscript while in fullscreen mode

    I am using Flash 9.0 (CS3 Pro). I am coding in Actionscript
    3.0
    I have two swf files, both interactive. During playback of
    the, a mouse event launches the second. I also want the mouse event
    to trigger a switch to fullscreen mode. The second swf is
    non-linear and requires user input to jump to the appropriate frame
    of the timeline. Everything tests and runs perfectly during
    standard screen mode but whenever I try to load and play the
    external swf file in fullscreen mode, Flash recognizes the
    actionscript built into the original SWF but ignores all of the
    Actionscript (this.stop(), this.gotoAndPlay(), etc.) embedded in
    the second (external) swf file.
    How can I get external swf files to load with their scripted
    functionality in fullscreen mode?
    Thanks for the help.
    Aaron
    The code I am using is:
    // --- this is the code contained in the first swf file
    // function to launch second SWF file
    function movieLaunch(event:MouseEvent):void
    // Sets display mode to fullscreen. With this line present,
    Flash does not look at any Actionscript in ip.swf
    // If I comment the below line out, the second SWF plays
    correctly and has full functionality
    stage.displayState = "fullScreen";
    // load and launch second movie (ip.swf) which is located in
    the same directory
    var request:URLRequest = new URLRequest("ip.swf");
    var loader:Loader = new Loader();
    loader.load(request);
    addChild(loader);
    // Sets the listener for the button that will launch the
    second movie.
    launchMovieButton.addEventListener(MouseEvent.CLICK,
    movieLaunch);
    Text

    The keyboard is disabled in fullscreen mode. This may be
    causing the problem?

  • External SWF layer problem

    I can only guess if its a layer / stacking problem or not, but I have a main fla file that loads three external SWF's, all ontop of each other, three buttons for each movie, that designate that movie is the visible one playing.
    It's basically a portfolio site.  You can see the site here
    www.tvnstudios.com/loadvis.html
    Why aren't the movies playing smoothly?  The FPS rate is the same for all three of the external SWF's and for the main fla that is loading them.
    Can anyone help? 
    I'd be so grateful!
    Thanks,
    -T
    p.s.  I'm including the fla file that has the actionscript that loads the movies.  It's a small code, but maybe the error is in there somewhere...

    If you are loading all of the files and they are all playing at the same time, that could be the problem.  Invisible files still eat up their share of the processor if they are left in a playing mode.
    I am unable to determine there is any slowness, primarily due to not knowing what the first one is supposed to be doing and the others appear to be flip book implementations that work fine as long as they are only the couple of pages I can see.

  • Problem with volume handle and external SWF

    Hello I'm having 2 problems.
    The first is that when loading an external swf in my main SWF I get this in the output window:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at audio_fla::list_1/frame1()
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at flash.display::MovieClip()
    at audio_fla::MainTimeline()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at audio_fla::MainTimeline/frame1()
    But it still works. Its an mp3 player.
    The other problem is that the loaded SWF has a volume controller. When I test the external SWF by itself it works fine. When I load it on my main SWF when I start to drag the handle on my volume slider and MOUSE_UP outside the handle it still keep dragging the handle.
    The code of my main SWF is:
    import caurina.transitions.*;
    var _currentCategory:String = "";
    var percent:String = "";
    var loader = new Loader();
    loader.name="videoLoader";
    loadermc.visible=false;
    cat.addEventListener(MouseEvent.MOUSE_OVER, onOverCat);
    cat.addEventListener(MouseEvent.MOUSE_OUT, onOutCat);
    cat.addEventListener(MouseEvent.CLICK, onClickCat);
    btnback.addEventListener(MouseEvent.MOUSE_OVER, onOverCat);
    btnback.addEventListener(MouseEvent.MOUSE_OUT, onOutCat);
    btnback.addEventListener(MouseEvent.CLICK, onClickBack);
    cat.buttonMode = true;
    btnback.buttonMode = false;
    btnback.visible = false;
    function onOverCat(e:MouseEvent):void{
         Tweener.addTween(e.target, {alpha:.5 , time:.5});
    function onOutCat(e:MouseEvent):void{
         Tweener.addTween(e.target, {alpha:.25 , time:.5});
    function onClickBack(e:MouseEvent):void{
         loader.unloadAndStop();
         loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
         lcontent.visible = false;
         cat.visible = true;
         Tweener.addTween(cat, {alpha:1, time:1});
         btnback.buttonMode = false;
         btnback.visible = false;
         cat.buttonMode = true;
         toptxt.text = "SELECCIONE UNA CATEGORIA"
    function onClickCat(e:MouseEvent):void{
         lcontent.visible=true;
         cat.buttonMode = false;
         Tweener.addTween(cat, {alpha:0, time:1, onComplete:function(){
                                  cat.visible = false;                                                       
                                  btnback.buttonMode = true;
                                  btnback.visible = true;
                                       loaderTweenIn(e.target.name);
    function loaderTweenIn (c:String):void{
         var category:String = c+".swf";
         trace(category);
         loader.load(new URLRequest(category));
         loader.contentLoaderInfo.addEventListener (Event.COMPLETE, movieLoaded);
            loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, movieProgress);
    function ioErrorHandler(e:IOErrorEvent):void{
         trace("ioErrorHanlder: "+e);
    function movieLoaded(e:Event):void{
         trace("The movie has loaded");
         lcontent.addChild(loader);
         loadermc.visible=false;
    function movieProgress(e:ProgressEvent):void{
         loadermc.visible = true;
    //     percent=String(Math.floor(e.bytesLoaded / e.bytesTotal * 100)) + "%";
         trace("The movie is loading "+Math.floor(e.bytesLoaded / e.bytesTotal * 100));
    The code on my external SWF is:
    import caurina.transitions.*;
    volume_mc.slider_mc.buttonMode = true;
    var myXML:XML;
    var thb:Thbs;
    var myThumbs:XMLList;
    var totalThumbs:Number;
    var thumbHeight:Number=50;
    var i:uint = 0;
    var preloader:LoaderAnim;
    var yCounter:Number = 0;
    var container:MovieClip;
    var musicReq:URLRequest;
    var music:Sound = new Sound();
    var sc:SoundChannel;
    var currentSound:Sound = music;
    var pos:Number;
    var songPlaying:Boolean = false;
    var songlist:XMLList;
    var currentIndex:Number = 0;
    mc_sound.mute.visible=false;
    var xmlLoader:URLLoader = new URLLoader();
    ///////////////////////////PLAYLIST//////////////////
    function initMediaPlayer(e:Event):void{
         myXML = new XML(xmlLoader.data);     
         myThumbs = myXML.*;
         totalThumbs = myThumbs.length();
         trace("The total thumbs are "+totalThumbs);
         createContainer();
         callThumbs();
    xmlLoader.load(new URLRequest("audio.xml"));
    function createContainer():void{
         container = new MovieClip();
         list.ch.addChild(container);
         container.y = 0;
         container.x = 0;
         container.buttonMode = true;
    function onOver(e:MouseEvent):void{
         var t:Loader = Loader(e.target);
         Tweener.addTween(t, {alpha:.5, time:1});
    function onOut(e:MouseEvent):void{     
         var t:Loader = Loader(e.target);
         Tweener.addTween(t, {alpha:1, time:1});
    function callThumbs():void{
              var thumbURL = myThumbs[i].@thumb;
              var thumbTitle:String = myThumbs[i].@title;
              var thumbDesc:String = myThumbs[i];
              trace("Loading "+thumbURL);
              trace("Title "+thumbTitle);
              trace("Desc "+thumbDesc);
              var thumbLoader = new Loader();
              thumbLoader.load(new URLRequest(thumbURL));
              thumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);
              thumbLoader.name=i;
              thumbLoader.x=5;
              thumbLoader.y=5;
              thb = new Thbs();
              container.addChild(thb);
              thb.thb_title.htmlText = thumbTitle;
              thb.thb_desc.autoSize = TextFieldAutoSize.LEFT;
              thb.thb_desc.htmlText = thumbDesc;
              thb.y = (thumbHeight+2)*yCounter;
              preloader = new LoaderAnim();
              preloader.x = thb.x + 20;
              preloader.y = thb.y+ 20;
              container.addChild(preloader);
              yCounter++;
    function thumbLoaded(e:Event):void{
         var thbx:Loader = Loader(e.target.loader);
         thb.addChild(thbx);
         thbx.addEventListener(MouseEvent.MOUSE_OVER, onOver);
         thbx.addEventListener(MouseEvent.MOUSE_OUT, onOut);
         container.removeChild(preloader);
         i++;
         if (i<totalThumbs){
              callThumbs();
         if (i==totalThumbs){
              startAudio();
    xmlLoader.addEventListener(Event.COMPLETE, initMediaPlayer);
    ///////////////////////////////////////AUDIO//////////////////////////
    function startAudio():void{
         songlist = myXML.*;;//this is the same as myXML.*;
         trace("This is the first song "+songlist[0].@song);
         musicReq = new URLRequest(songlist[0].@song);
         music.load(musicReq);
         sc = music.play();
         sc.addEventListener(Event.SOUND_COMPLETE, nextSong);     
    next_btn.addEventListener(MouseEvent.CLICK, nextSong);
    prev_btn.addEventListener(MouseEvent.CLICK, prevSong);
    pause_btn.addEventListener(MouseEvent.CLICK,pauseSong);
    stop_btn.addEventListener(MouseEvent.CLICK,stopSong);
    function nextSong(e:Event):void
         if (currentIndex < (songlist.length() - 1))
              currentIndex++;
         else
              currentIndex = 0;
         var nextReq:URLRequest = new URLRequest(songlist[currentIndex].@song);
         var nextTitle:Sound = new Sound(nextReq);
         sc.stop();
         sc = nextTitle.play();
         songPlaying = true;
         currentSound = nextTitle;
         sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
    function prevSong(e:Event):void
         if (currentIndex > 0)
              currentIndex--;
         else
              currentIndex = songlist.length() - 1;
         var nextReq:URLRequest = new URLRequest(songlist[currentIndex].@song);
         var prevTitle:Sound = new Sound(nextReq);
         sc.stop();
         sc = prevTitle.play();
         songPlaying = true;
         currentSound = prevTitle;
         sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
    function pauseSong(e:Event):void
         pos = sc.position;
         sc.stop();
         songPlaying = false;
         play_btn.addEventListener(MouseEvent.CLICK,playSong);
    function playSong(e:Event):void
         if(songPlaying == false)
              sc = currentSound.play(pos);
              sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
              songPlaying = true;
              play_btn.removeEventListener(MouseEvent.CLICK,playSong);
    function stopSong(e:Event):void
         sc.stop();
         pos = 0;
         songPlaying = false;
         play_btn.addEventListener(MouseEvent.CLICK,playSong);
    ///////////////////////////////VOLUME/////////////////////////////
    var xOffset:Number;
    var xMin:Number = 0;
    var xMax:Number = volume_mc.track.width;
    volume_mc.slider_mc.addEventListener(MouseEvent.MOUSE_DOWN, sliderDown);
    volume_mc.slider_mc.addEventListener(MouseEvent.MOUSE_UP, sliderUp);
    stage.addEventListener(MouseEvent.MOUSE_UP, sliderUp);
    function sliderDown(e:MouseEvent):void{
         stage.addEventListener(MouseEvent.MOUSE_MOVE, sliderMove);
         xOffset = mouseX - volume_mc.slider_mc.x;
    function sliderUp(e:MouseEvent):void{
         stage.removeEventListener(MouseEvent.MOUSE_MOVE, sliderMove);
    function sliderMove(e:MouseEvent):void{
         volume_mc.slider_mc.x = mouseX - xOffset;
         if(volume_mc.slider_mc.x<=xMin){
              volume_mc.slider_mc.x = xMin;
         if(volume_mc.slider_mc.x>=xMax){
              volume_mc.slider_mc.x = xMax;
         var vol:Number = volume_mc.slider_mc.x*.01;
         var st:SoundTransform = new SoundTransform(vol,0);
         sc.soundTransform = st;
         trace("The volume is "+vol);
         if(vol==0){
              mc_sound.mute.visible=true;
         }else{
              mc_sound.mute.visible=false;
         e.updateAfterEvent();

    I found the solution.

  • AS3 load external swf problem, please help...

    Hey guys, I am really in need of an answer here. I would tremendously grateful if someone has the answer. I'll keep it simple and right to the point:
    1. I have created "index.swf" in AS3. Has it's own "MainClass" class.
    2. I created "holder.swf" which is the main landing page. Has 2 buttons, for the viewer to load the site in fullscreen or standard.
    3. In the timeline of "holder.swf" I have created 2 frames, 1st frame containing the buttons, second frame containing the AS3 external swf loader script.
    It does not seem to want to load my "index.swf".
    I have tested a million different ways, it load other swf's just fine, AS2 and AS3, but for some strange reason it just will NOT load "index.swf".
    This is driving me crazy, I have a feeling it has something to do with a class conflict. I have tried (import MainClass;) in the first frame of "holder.swf" and no luck.
    PLEASE GUYS, LET ME KNOW IF YOU KNOW THE ANSWER!
    THANK YOU SO MUCHO.
    Michael

    Hey kglad,
    Thanks for the quick reply!
    Well here is the problem... With the exception of a few things I need to update, as well as implementing some better preloaders etc... the site is running alright...
    About a week ago I decided that I wanted to site to start with the above landing page. A simple "holder.swf" which would give the viewer something to look at before entering the site... (ideally I want to find a script that will begin loading "index.swf" while the viewer is still on "holder.swf", but I'll figure that out later).
    Anyhow, I created "holder.swf" as I have many times before, and for some reason it does not seem to want to load "index.swf" into the second frame when instructed to do so... does that make sense?
    So... ideally I would like the site to start on the above graphic, then once the button is clicked, "index.swf" opens up...
    It's driving me crazy, because my code works on other swf's I've tested it with, just not with index.swf, which leads me to believe there is something in the MainClass.as file which is causing it not to load...
    What are your thoughts?
    Oh, and many thanks again!!!
    M

  • External SWF problems

    i have a few SWF files loading into the main SWF. I am using
    a blank movie clip to load the external SWFs.
    loadMovie("photos-color.swf", "color");
    That is actionscript I use to load the external SWF into the
    main SWF.
    I go to one page on my site, download the external SWF, then
    go to another page and when I go back to the first page, it reloads
    the SWF again. Just a pain in the ***.
    What do I have to add to that to tell the file not to reload
    once it has already been loaded?
    I have been searching all over and asking around and haven't
    found any answers. I've looked into listeners, is that the right
    direction at least?
    Thanks in advance for any help.
    jesse

    ok so this is what i have.
    SCENES- (the dashed are the sub-categories)
    home
    design
    -graphic
    -web
    -type
    -drawings
    photos
    -color
    -b/w
    links
    in the COLOR scene, i have an animation that drops down and
    shows the area where the photos will load. in that movie clip of
    the dropdown area, i have the script that calls for the external
    SWF.
    loadMovie("photos-color.swf", "color");
    then it loads the movie and shows the clip of the pictures
    and works fine for what i want it to do.
    but if i click on B/W, then return to COLOR, the whole
    downloading starts again.
    i hope that explains it better.
    All i really want to have happen is to have the file download
    the first time and when revisited, just open up as if it were just
    placed there.
    I am hoping explaining the layout might help.

  • External swf path problem

    Hi there,
    I've just added some external swf.'s to my site which contain
    various slideshows and galleries which now don't work at all. I
    understand that all the paths in my external swf.'s containing
    _root will assume that the main timeline is now the _root movie, so
    I wondered if there might be a quicker way of correcting all the
    paths without having to go through each one individually as there
    are literally hundreds!
    Any help would be greatly appreciated. Many thanks.

    Hey batchas07,
    Thanks for getting back to me. Erm, I'm pretty new to flash,
    (the actionscript side of it anyway), so I didn't really follow
    your first solution. I'm currently using Flash MX so would that
    still work?
    I read somewhere else to try the 'this._lockroot = true;'
    script in the first frame of my external swfs. but this doesn't
    seem to have done the trick either?
    To give you a bit more of an idea, I'm building a site which
    has five links at the bottom of the stage which each take you to a
    different container movie clip, (each with an instance name of
    'holder'), which each of the external swfs load in to. I'm using
    the (loadMovie("external.swf", "holder") ) method of getting the
    movies. All the movies load in fine, but as some of them are
    slideshows with movie clips inside them I'm guessing their paths
    will all be wrong which is why they don't work. The only way I have
    managed to make the main movie recognize the external swfs is to
    add 'holder.' after '_root.' to all the paths to buttons and movie
    clips in these external swfs, but doing this to all of them will
    take a long time.
    Really not sure why the 'this._lockroot = true' method isn't
    working out for me???
    Thanks again for the help.

Maybe you are looking for

  • Application keeps moving out of the window to a phantom screen?

    I can start the application and it works fine. However it won't stay on my home screen and I have checked the other spaces and it won't stay there either. It keeps drifting off to the top and off the screen. Any ideas?

  • Problems with kde 4

    hi. sorry for my bad english.. mm i have some troubles with kde 4. in my desktop, a square appear and i have no idea about it. but it occur sometimes, not always. what could be?

  • BADI for EDI Invoice outbound

    Dear experts, in my special scenario I would like that in the EDI outbound invoice Batch qty. is not showing for segment E1EDP19 which is showing only the Batch nr. I wanted to use a BADI for EDI outbound invoice which uses the logic for transfering

  • Configuring an iMac for VPN network

    Operating systems on one side 10.5.8 on end side either Tiger, Leopard or Snow Leopard. At work we have a VPN router (D-Link) and I would like to connect to work from home on my Mac. New to VPN stuff. What are the basics settings I should have on my

  • My project

    heyall, i would like to start developing web pages bringing together the java enterprise languages i.e. java. ejb, jsp's together but would like a little help in how to go about this. basically, i have a design I would like to implement but I do not