Import and playback of an external SWF

I have a SWF that plays well if included in a HTML here.

Given that this project becomes larger, I am considering the preload the SWF before him to play. I don't know if I enter the complete event sequence because I get an error message.

TypeError: Error #1009: it is impossible to access the property or method of an object reference zero.
to monroman$ iinit)


Meaning: cannot access a property or method of a null object referenced (or something like that).

Code is below.



Thanks in advance for your help.

You are welcome.

Tags: Adobe Animate

Similar Questions

  • Problem with the playback of the external SWF sound

    Hello

    I need to load the external SWF file, which contains the simple + audio image sequence. I used the MovieClipLoader class for this and also a preloader, where I check if I can run the SWF safely, without having to pause later and continue with loading. It works similar to video YouTube, where the video is buffered.

    The problem is that when I load the SWF file and run it, the audio start to play later. I tried more cases and the reason is that even if I load enough of the SWF, I can be certain I can start reading, because it is not enough for audio, if you start playing a little later. When I insert more, the audio begins to play immediately.

    So the question is, is there a way how can I check if the audio is loaded and ready to play?

    Thank you

    Michal

    If you can inspect the external swf fla enough to know that synchronize sound is set to stream, you should be able to look at the scenario where the sound is attached and determine the number of images, the sound is.

  • Loading and unloading of the external swf with buttons

    Alright. Here's the deal. I have 7 buttons on my main page, on the left side of the screen. I want the buttons to the external swf on the right to load and unload then when you push a different button. Should I make a table? Do I need a clip vacuum film to load each swf in?

    ///////////////Buttons/////////////////////

    graphics - load the thumbnail scroll bar

    mixed technique - load the thumbnail scroll bar

    photography - load the thumbnail scroll bar

    illustration - charge the miniature scroll bar

    Words - list history of charges

    Contact - contact information of charges

    charges about - bio

    ////////////////////////////////////////////

    Thanks for any help.

    If you are unable to publish for flash player 10, you will need to use the instead of unloadAndStop() unload() method.

  • Import and playback problems.

    I am an old user of Premiere Pro CS4, try the version first CS6 cloud for the first time. When I try to make a simple import .avi or .mov clips the audio is available in, not the video. The computer is new with a processor i5 and 8 GB of RAM. In addition, clips shot with a Canon 5 d will import but does not play smoothly. I'm puzzled.

    In general, it was this solution: http://helpx.adobe.com/premiere-pro/kb/features-presets-missing-premiere-pro.html

  • How to display text in main.swf to external.swf

    Hello

    I don't know how to access the fields of text, video clips and so on of external SWF.

    in my main.swf is input field text called nickname_txt and password_txt if nickname_txt and password_txt are correct loads, flash external swf called userinterface.swf.

    in userinterface.swf the text field is called username_txt

    and I need to display text of main.swf nickname_txt userinterface.swf username_txt

    Thank you very much in advance

    SWF to swf communication

    http://kb2.Adobe.com/community/publishing/918/cpsid_91887.html

  • Loading external SWF - I thought it would be easy...

    Apologies: I do not really have my head around AS3! All I want to do is stop the main timeline until an external SWF is loaded and then run the external SWF file. Everything works fine locally, but the server stops just the timeline. The ext SWF appears to load but then when it ends, nothing happens, the timeline is stopped and does not play the loaded SWF file.

    Here is the site: johnmarshallmedia.com/default.aspx

    Any help appreciated.

    The following actionscript code:

    Stop();


    var req:URLRequest = new URLRequest ("intro2.swf");

    var loader: Loader = new Loader;


    function fileLoaded(event:Event):void

    {

    addChild (loader);

    }

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, fileLoaded);


    Loader.Load (req);

    Use Firebug or Charles or Fiddler to see what happens when you run it on the server. Use Flash debug player to see the execution errors. The html code integrates the Flash in the same folder?

  • Why I can't load external .swf boxes?

    Hello world...

    I am trying to load an external .swf that contains check boxes. The external .swf has a script in the applications folder on FMS3 server-side.

    When I insert the external .swf locally, it works fine.

    If I load the external .swf remotely with an Apache Web server, the external .swf is loaded but do not appear the boxes...

    Why?

    Please, help me...

    Emiliano.

    Are these components AS2 or AS3? If the latter, I would advise you to place the components in a RSLS (runtime shared library) and active in the external SWF, then reference the RSL.

    -Robert

    --

    Robert Reinhardt

    Creator, videoRx.com

    Author, series Bible Flash and video for Adobe Flash CS4 Professional Studio Techniques

    Adobe Community Expert

    http://blogs.flashsupport.com/Robert

  • AS3: How to access and control embedded sounds in an external swf?

    I rarely use the sounds in AS3/Flash. I use Flash Pro CS6, but I can't seem to understand how access control (play, stop, etc) sounds embedded in a SWF external loading in the main SWF file.

    It is easy to control them when they are incorporated on the main swf. However, on a responsible external SWR, I get all sorts of errors. For this application, I really need to incorporate in the external SWF file.

    I've read several solutions, but none seems not to work.

    I integrate the sound file mp3 called soundSegment1.mp3 tool to import Flash CS6 and then open the properties panel actionscript Flash select the name of the class: SoundSegment1. Can I change the class ID and create a file named SoundSegment1.as, and it saved right next to my document class main.as in the same directory. The code for the SoundSegment1 class looks like this:

    package  {

       
    import flash.media.*;


       
    public class SoundSegment1 extends Sound
       
    {

           
    public function SoundSegment1 ()
           
    {
               
    // no code in here
           
    }


           
    public function playSound()
           
    {
               
    var soundSegment1:Sound = new SoundSegment1();
               
    var channel:SoundChannel = soundSegment1.play();
           
    }
       
    }
    }

    Then, in my main.as, I made several attempts to play this sound such as:

    var fileLocation:URLRequest = new URLRequest(SWFToLoad);

    loader.load(fileLocation);

    loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);

    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeListener);

    loader.contentLoaderInfo.addEventListener(Event.INIT, initListener); 


    function initListener(e:Event):void // I also placed this code on the completeListener and it didn't work

    {

         loader.content.soundSegment1.playSound(); // doesn't work. 

    }

    I get:

    Line XXX 1061: Call to a possibly undefined method playSound through a reference with static type flash.display:DisplayObject.

    Otherwise, I also read that I should be able to do something like this anywhere in the Main.as file:

    var theClass:Class = Class(loader.content.getDefinitionByName("SoundSegment1")); var theSound:theClass = new theClass(); theSound.play()  //doesn't work either.

    I also tried on the completeListener:

    var TheClass:Class = e.target.applicationDomain.getDefinition("SoundSegment1") as Class;

    var theSound:TheClass = new TheClass();
    theSound
    .play()  //doesn't work either.

    I get:

    ReferenceError: Error #1065: Variable SoundSegment1 is not defined. at flash.system::ApplicationDomain/getDefinition()

    I'm stuck and I really need this to work. I would really appreciate your help.

    Thanks in advance for any help provided. I really need to make it work, because I can not simply incorporate into the main SWF or load them individually outside one by one.

    Thanks again!


    You can use the load and loadCompleteF below:

    var SWFToLoad: String =...;

    var s:String = "SoundSegment1";

    Load (SWFToLoad, s);

    function load (urlS:String, classS:String) {}

    var ldr:Loader = new Loader();

    ldr.contentLoaderInfo.addEventListener (Event.COMPLETE, function(e:Event){loadCompleteF(e,classS);});)

    LDR. Load (new URLRequest (URL));

    }

    function loadCompleteF(e:Event,classS:String):void {}

    var loadedAppDomain:ApplicationDomain = e.target.content.loaderInfo.applicationDomain;

    var C: Class = loadedAppDomain.getDefinition (classS) in class;

    var instance: * = new C();

    Sound (instance). Play();

    }

  • Load external .swf and button top

    Hello!

    I have a problem here! I want to load a file (created from inDesign) external .swf and then on load a button at home (a small image that I created with the name "home_btn"), which refers to my home page to say frame 90

    Any help it would be greatly appreciated,

    Frank

    I founded by myself, I just create a clip of this button and this is my code in case anyone has the same problem...

    import flash.events.MouseEvent;

    import flash.display.Loader;

    import flash.net.URLRequest;

    var loader: Loader = new Loader();

    Loader.Load (new URLRequest ("MyInDesignSwf.swf"));

    addChild (loader);

    addChild (home_front);

    home_front.addEventListener (MouseEvent.Click, playClickedExit)

    Stop();

    function playClickedExit(event:MouseEvent):void

    {

    removeChild (loader);

    gotoAndPlay (90);

    }

  • External SWF imported successfully, can not put it in the video

    Hi all

    I started to learn AS3 and little by little getting used to trying to get external swf in video clip.

    SWF target successfully imported and staged, when I post what I see swf target plays.

    ------------------------------------------------------------------------------------------ ----

    import flash.display.MovieClip;

    var BGLoader:Loader = new Loader();

    var BGurl:URLRequest = new URLRequest("HomeBG.swf");

    BGLoader.load (BGurl);

    BGLoader.y = 0;

    BGLoader.x = 0;

    addChild (BGLoader);

    ------------------------------------------------------------------------------------------ ----

    As a next step, I want to put the swf in the video and get more control, but when I publish below only I see is a background empty, without any error.

    ------------------------------------------------------------------------------------------ ----

    import flash.display.MovieClip;

    var BGLoader:Loader = new Loader();

    var BGurl:URLRequest = new URLRequest("HomeBG.swf");

    BGLoader.load (BGurl);

    BGLoader.y = 0;

    BGLoader.x = 0;

    addChild (BGLoader);

    var animMC = MovieClip (BGLoader.content) .getChildAt (0) as MovieClip;

    addChild (animMC);

    ------------------------------------------------------------------------------------------ ----

    Missing something?

    Any help would be appreciated, thanks.

    You cannot access Loader.content after load completed successfully.

    Try this,

    import flash.events.Event;

    var BGLoader:Loader = new Loader();

    var BGurl:URLRequest = new URLRequest("HomeBG.swf");

    BGLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, completeHandler);

    BGLoader.load (BGurl);

    BGLoader.y = 0;

    BGLoader.x = 0;

    addChild (BGLoader);

    var animMC:MovieClip;

    function completeHandler(event:Event)

    {

    animMC = event.currentTarget.content;

    addChild (animMC);

    }

  • Delete / external swf or the files in the flash file main to unload and load a new swf file and memory garbage collection.

    I can't delete / unload the example swf files external when the carousel.swf (portfolio) appears and press the button about the content overlaps the carousel (portfolio). How can I delete / unload an external swf file in the main flash file and load a SWF, so that at the same time remove garbage collection memory operation?

    This is the error messages I receive: "TypeError: Error #2007: child parameter must be non null.»

    at flash.display::DisplayObjectContainer/removeChild()

    " to index_fla::MainTimeline/Down3().

    Import nl.demonsters.debugger.MonsterDebugger;

    var d: MonsterDebugger = new MonsterDebugger (this);

    stage.scaleMode = StageScaleMode.NO_SCALE;

    internship. Align = StageAlign.TOP_LEFT;

    stage.addEventListener (Event.RESIZE, resizeHandler);

    is the charger for the portfolio page swf

    var loader: Loader;

    var loader2:Loader;

    var loader3:Loader;

    var loader1:Loader;

    resize the content

    function resizeHandler(event:Event):void {}

    resizes the portfolio page to Center

    Loader.x = (stage.stageWidth - loader.width) *. 5;

    Loader.y = (stage.stageHeight - loader.height) *. 5;

    resizes on page to Center

    loader3.x = (stage.stageWidth - 482) *.5 - 260;

    loader3.y = (stage.stageHeight - 492) *.5 - 140;

    * loader2.x = (stage.stageWidth - 658.65) *. 5;

    loader2.y = (stage.stageHeight - 551.45) *. 5; * /

    }

    addEventListener (Event.ENTER_FRAME, onEnterFrame, false, 0, true);

    function onEnterFrame(ev:Event):void {}

    var requesterb:URLRequest = new URLRequest ("carouselLoader.swf");

    Charger = null;

    loader = new Loader();

    Loader.Name = "carousel1.

    Adds gallery.swf in the scene at the beginning of the film

    loader.contentLoaderInfo.addEventListener (IOErrorEvent.IO_ERROR, ioError);

    function ioError(event:IOErrorEvent):void {}

    trace (Event);

    }

    try {}

    Loader.Load (requesterb);

    } catch (SecurityError: error) {}

    trace (Error);

    }

    addChild (loader);

    Loader.x = (stage.stageWidth - 739) *. 5;

    Loader.y = (stage.stageHeight - 500) *. 5;

    stopover gallery.swf duplication and more on enter frame

    removeEventListener (Event.ENTER_FRAME, onEnterFrame);

    }

    PORTFOLIO BUTTON

    Add eventlistner so that gallery.swf can be loaded

    MovieClip (root),.nav.portfolio.addEventListener (MouseEvent.MOUSE_DOWN, down, false, 0, true);

    function Down(event:MouseEvent):void {}

    Re add listener for contact.swf and about.swf

    MovieClip (root).nav.info.addEventListener (MouseEvent.MOUSE_DOWN, Down1, false, 0, true);

    MovieClip (root).nav.about.addEventListener (MouseEvent.MOUSE_DOWN, Down3, false, 0, true);

    discharge of entry gallery.swf frame if users press portfolio in nav button

    var applicant: URLRequest = new URLRequest ("carouselLoader.swf");

    Charger = null;

    loader = new Loader();

    Loader.Name = "carousel."

    loader.contentLoaderInfo.addEventListener (IOErrorEvent.IO_ERROR, ioError);

    function ioError(event:IOErrorEvent):void {}

    trace (Event);

    }

    try {}

    Loader.Load (requester);

    } catch (SecurityError: error) {}

    trace (Error);

    }

    addChild (loader);

    Loader.x = (stage.stageWidth - 739) *. 5;

    Loader.y = (stage.stageHeight - 500) *. 5;

    removeChild (getChildByName ("about"));

    removeChild (getChildByName ("carousel1"));

    delete eventlistner and prevents duplication of the gallery.swf

    MovieClip (root).nav.portfolio.removeEventListener (MouseEvent.MOUSE_DOWN, down);

    }

    INFORMATION BUTTON

    Add eventlistner so that info.swf can be loaded

    MovieClip (root).nav.info.addEventListener (MouseEvent.MOUSE_DOWN, Down1, false, 0, true);

    function Down1(event:MouseEvent):void {}

    This adds the EventListener for portfolio so that the end user can re-post if they wish.

    MovieClip (root),.nav.portfolio.addEventListener (MouseEvent.MOUSE_DOWN, down, false, 0, true);

    MovieClip (root).nav.about.addEventListener (MouseEvent.MOUSE_DOWN, Down3, false, 0, true);

    var applicant: URLRequest = new URLRequest ("contactLoader.swf");

    loader2 = null;

    loader2 = new Loader();

    loader2. Name = "contact".

    loader2.contentLoaderInfo.addEventListener (IOErrorEvent.IO_ERROR, ioError);

    function ioError(event:IOErrorEvent):void {}

    trace (Event);

    }

    try {}

    loader2. Load (requester);

    } catch (SecurityError: error) {}

    trace (Error);

    }

    addChild (loader2);

    loader2.x = (stage.stageWidth - 658.65) *. 5;

    loader2.y = (stage.stageHeight - 551.45) *. 5;

    delete eventlistner and prevents duplication of the info.swf

    MovieClip (root).nav.info.removeEventListener (MouseEvent.MOUSE_DOWN, Down1);

    }

    ON THE BUTTON

    Add eventlistner so that info.swf can be loaded

    MovieClip (root).nav.about.addEventListener (MouseEvent.MOUSE_DOWN, Down3, false, 0, true);

    function Down3(event:MouseEvent):void {}

    This adds the EventListener for portfolio so that the end user can re-post if they wish.

    MovieClip (root),.nav.portfolio.addEventListener (MouseEvent.MOUSE_DOWN, down, false, 0, true);

    MovieClip (root).nav.info.addEventListener (MouseEvent.MOUSE_DOWN, Down1, false, 0, true);

    var applicant: URLRequest = new URLRequest ("aboutLoader.swf");

    loader3 = null;

    loader3 = new Loader();

    loader3. Name = "a connection"

    loader3.contentLoaderInfo.addEventListener (IOErrorEvent.IO_ERROR, ioError);

    function ioError(event:IOErrorEvent):void {}

    trace (Event);

    }

    try {}

    loader3. Load (requester);

    } catch (SecurityError: error) {}

    trace (Error);

    }

    addChild (loader3);

    loader3.x = (stage.stageWidth - 482) *.5 - 260;

    loader3.y = (stage.stageHeight - 492) *.5 - 140;

    removeChild (getChildByName ("carousel"));

    removeChild (getChildByName ("carousel1"));

    delete eventlistner and prevents duplication of the info.swf

    MovieClip (root).nav.about.removeEventListener (MouseEvent.MOUSE_DOWN, Down3);

    }

    Stop();

    You call unload() on objects that you cancelled - where the error.

    You should do something like:

    {if (loader2)}

    loader2. Unload();

    }

    As for the null value passed into the function - null is a default value. In this way, you can call the low past nothing:

    Down()

    Or you can use it as a handler in which case it will be called by the Auditor:

    Down (mouseEventInstnace);

  • External swf on Air Android and IOS

    Hello

    Can AIR and IOS android application download and play an external SWF with code inside?

    I created android app AIR (SDK version 4.0) that load an external swf with simple clip on the stage.

    var loader: Loader = new Loader();

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, onLoaded);

    Loader.Load (new URLRequest ("2.swf"));

    function onLoaded(e:Event):void

    {

    addChild (loader);

    }

    I installed this on device android AIR app but I see no external swf on the stage.

    Thanks in advance

    You must add the external swf file for included files.  and for ios, you must assign the loadercontext property.

  • public var and external swf

    Hello!

    I have a problem with vars. The situation is the same that I wrote here Re: external swf

    I public var (for example, ZZZ) in the code of MAIN.swf (main class is Main.as), and I want to access it from loading code EXTERNAL.swf.

    But nothing helps, flash says:

    There is no ZZZ in hand code

    There is no ZZZ on stage.root

    There is no ZZZ in any parents.

    But if a ZZZ in EXTERNAL code and that you want to access from HAND, (the reverse), ZZZ is easy to find.

    your variable is defined in the main scenario for MAIN.swf so you just need a path that he.

    This exact path depends on the scope of the EXTERNAL charger.

    (and, of course, you must make sure that this variable is set before trying to reference it).

  • Load external swf and stopping on the 1st frame.

    Hello everyone

    I use following code to display an external swf file on the iPad.

    var request: URLRequest = new URLRequest ("http://< server ip > / test.swf");

    loader = new Loader();

    Loader.Load (request);

    The file load passes through each image and closes the application.

    Y at - it will be a way to stop the 1st frame once the file is loaded and move between the ribs to the?

    Thank you

    If you listen to when the charger is finished, you can stop the swf file:

    var mc:MovieClip;

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, swfloaded);

    function swfloaded(e:Event) {}

    MC = e.target.content as MovieClip;

    MC. Stop();

    }

    Now you can do what you like in this clip. As:

    mc.gotoAndStop ('some ' label');

    or:

    mc.gotoAndStop (10);

  • External SWF playback of sound unloading

    I have an external swf loaded in my film. This script is implemented as to cancel the swf when leaving the frame in which the .swf was called.

    function checkForMusicLoader (): void

    {

    If (myLoader! = null)

    {

    music player exist, unload

    myLoader.unloadAndStop ();

    removeChild (myLoader);

    myLoader = null;

    }

    It is effective to remove visually, but the sound of it isn't yet. Googling the subject, looks like I'm not the first with this question. My problem is usually because I can't see directly and right solution however.

    Thanks to sinious for their help so far, other suggestions much appreciated.

    When you say explicitly stop the data flow in the swf file that is loaded, do you mean the flow must be stopped of in the original swf file, or my main timeline must be coded as such to eliminate the flow.

    or the other may work.  but you must be explicit.

    SoundChannel your loaded swf file is it sc, you need to reference sc in the swf loaded to stop the noise.

    If you can live with stop all sounds, you can use SoundMixer.stopAll ();

    Also, just a thought, but if I loaded my .swf file in an empty movie clip and then had my timeline script remove the clip, this would achieve the same thing or not go?

    no go.

Maybe you are looking for