Import objects from external swf file

How i can import linkaged items of library of an external swf file im my project?

check the applicationdomain class.

Similar Messages

  • Remove / unload external swf file(s) from the main flash file and load a new swf file and garbage collection from memory.

    I can't seem to remove / unload the external swf files e.g when the carousel.swf (portfolio) is displayed and I press the about button the about content is overlapping the carousel (portfolio) . How can I remove / unload an external swf file from the main flash file and load a new swf file, while at the same time removing garbage collection from memory?
    This is the error message(s) I am receiving: "TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/removeChild()
    at index_fla::MainTimeline/Down3()"
    import nl.demonsters.debugger.MonsterDebugger;
    var d:MonsterDebugger=new MonsterDebugger(this);
    stage.scaleMode=StageScaleMode.NO_SCALE;
    stage.align=StageAlign.TOP_LEFT;
    stage.addEventListener(Event.RESIZE, resizeHandler);
    // loader is the loader for portfolio page swf
    var loader:Loader;
    var loader2:Loader;
    var loader3:Loader;
    var loader1:Loader;
    //  resize content
    function resizeHandler(event:Event):void {
        // resizes portfolio page to center
    loader.x = (stage.stageWidth - loader.width) * .5;
    loader.y = (stage.stageHeight - loader.height) * .5;
    // resizes about 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");
    loader = null;
    loader = new Loader();
    loader.name ="carousel1"
    //adds gallery.swf to stage at begining of movie
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader.load(requesterb);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader);
    loader.x = (stage.stageWidth - 739) * .5;
    loader.y = (stage.stageHeight - 500) * .5;
    // stop gallery.swf from duplication over and over again on enter frame
    removeEventListener(Event.ENTER_FRAME, onEnterFrame);
    //PORTFOLIO BUTTON
    //adds 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 adds 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);
    //unloads gallery.swf from enter frame if users presses portfolio button in nav
    var requester:URLRequest=new URLRequest("carouselLoader.swf");
        loader = 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 (error:SecurityError) {
    trace(error);
    addChild(loader);
    loader.x = (stage.stageWidth - 739) * .5;
    loader.y = (stage.stageHeight - 500) * .5;
    removeChild( getChildByName("about") );
    removeChild( getChildByName("carousel1") );
    // remove eventlistner and prevents duplication of gallery.swf
    MovieClip(root).nav.portfolio.removeEventListener(MouseEvent.MOUSE_DOWN, Down);
    //INFORMATION BUTTON
    //adds 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 re-adds the EventListener for portfolio so that end user can view again 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 requester: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 (error:SecurityError) {
    trace(error);
    addChild(loader2);
    loader2.x = (stage.stageWidth - 658.65) * .5;
    loader2.y = (stage.stageHeight - 551.45) * .5;
    // remove eventlistner and prevents duplication of info.swf
    MovieClip(root).nav.info.removeEventListener(MouseEvent.MOUSE_DOWN, Down1);
    //ABOUT BUTTON
    //adds 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 re-adds the EventListener for portfolio so that end user can view again 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 requester:URLRequest=new URLRequest("aboutLoader.swf");
    loader3 = null;
    loader3 = new Loader();
    loader3.name ="about"
    loader3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader3.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader3);
    loader3.x = (stage.stageWidth - 482) * .5 - 260;
    loader3.y = (stage.stageHeight - 492) * .5 - 140;
    removeChild( getChildByName("carousel") );
    removeChild( getChildByName("carousel1") );
    // remove eventlistner and prevents duplication of info.swf
    MovieClip(root).nav.about.removeEventListener(MouseEvent.MOUSE_DOWN, Down3);
    stop();

    Andrei1,
    Thank you for the helpful advice. I made the changes as you suggested but I am receiving a #1009 error message even though my site is working the way I wan it to work. I would still like to fix the errors so that my site runs and error free. This is the error I am receiving:
    "TypeError: Error #1009: Cannot access a property or method of a null object reference."
    I'm sure this is not the best method to unload loaders and I am guessing this is why I am receiving the following error message.
         loader.unload();
         loader2.unload();
         loader3.unload();
    I also tried creating a function to unload the loader but received the same error message and my portfolio swf was not showing at all.
         function killLoad():void{
         try { loader.close(); loader2.close; loader3.close;} catch (e:*) {}
         loader.unload(); loader2.unload(); loader3.unload();
    I have a question regarding suggestion you made to set Mouse Event to "null". What does this do setting the MouseEvent do exactly?  Also, since I've set the MouseEvent to null do I also have to set the loader to null? e.g.
    ---- Here is my updated code ----
    // variable for external loaders
    var loader:Loader;
    var loader1:Loader;
    var loader2:Loader;
    var loader3:Loader;
    // makes borders resize with browser size
    function resizeHandler(event:Event):void {
    // resizes portfolio page to center
         loader.x = (stage.stageWidth - loader.width) * .5;
         loader.y = (stage.stageHeight - loader.height) * .5;
    // resizes about page to center
         loader3.x = (stage.stageWidth - 482) * .5 - 260;
         loader3.y = (stage.stageHeight - 492) * .5 - 140;
    //adds gallery.swf to stage at begining of moviie
         Down();
    //PORTFOLIO BUTTON
    //adds eventlistner so that gallery.swf can be loaded
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    function Down(event:MouseEvent = null):void {
    // re adds 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);
    //unloads gallery.swf from enter frame if users presses portfolio button in nav
         var requester:URLRequest=new URLRequest("carouselLoader.swf");
         loader = new Loader();
         loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader.load(requester);
         } catch (error:SecurityError) {
         trace(error);
         this.addChild(loader);
         loader.x = (stage.stageWidth - 739) * .5;
         loader.y = (stage.stageHeight - 500) * .5;
    // sure this is not the best way to do this - but it is unload external swfs
         loader.unload();
         loader2.unload();
         loader3.unload();
    // remove eventlistner and prevents duplication of gallery.swf
         MovieClip(root).nav.portfolio.removeEventListener(MouseEvent.MOUSE_DOWN, Down);
    //INFORMATION BUTTON
         //adds eventlistner so that info.swf can be loaded
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         function Down1(event:MouseEvent = null):void {
         //this re-adds the EventListener for portfolio so that end user can view again 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 requester:URLRequest=new URLRequest("contactLoader.swf");
         loader2 = null;
         loader2 = new Loader();
         loader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);    
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader2.load(requester);
    }      catch (error:SecurityError) {
         trace(error);
         addChild(loader2);
         loader2.x = (stage.stageWidth - 658.65) * .5;
         loader2.y = (stage.stageHeight - 551.45) * .5;
    loader.unload();
    loader2.unload();
    loader3.unload();
         // remove eventlistner and prevents duplication of info.swf
         MovieClip(root).nav.info.removeEventListener(MouseEvent.MOUSE_DOWN, Down1);
    //ABOUT BUTTON
         //adds eventlistner so that info.swf can be loaded
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
         function Down3(event:MouseEvent = null):void {
         //this re-adds the EventListener for portfolio so that end user can view again 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 requester:URLRequest=new URLRequest("aboutLoader.swf");
         loader3 = null;
         loader3 = new Loader();
         loader3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader3.load(requester);
    }      catch (error:SecurityError) {
         trace(error);
         addChild(loader3);
         loader3.x = (stage.stageWidth - 482) * .5 - 260;
         loader3.y = (stage.stageHeight - 492) * .5 - 140;
         loader.unload();
         loader2.unload();
         loader3.unload();
         // remove eventlistner and prevents duplication of info.swf
         MovieClip(root).nav.about.removeEventListener(MouseEvent.MOUSE_DOWN, Down3);
         stop();

  • How can I stop timeline sounds in external swf files from playing during loading?

    I am having a problem with timeline sounds in external swf files playing during loading in a main swf. Can anyone help me?
    Here is some of the code from the main swf. I hope I have included enough.
    Thanks.
    import flash.events.MouseEvent;
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.events.ProgressEvent;
    import flash.events.Event;
    import flash.net.URLRequest;
    import fl.events.SliderEvent;
    import flash.media.SoundTransform;
    preloader_mc.fill_mc.scaleX = 0;
    var swfA:Array = ["part1.swf","part2.swf"];
    var frameA:Array = [];
    var currentLoader:Loader;
    var swfTotalFrames:int;
    var tl:MovieClip = this;
    var st:SoundTransform = new SoundTransform()
    var index:int = 0;
    loadNextF();
    play_slider.enabled = false;
    function loadNextF():void{
                    tl["loader_"+index] = new Loader();
                    tl["loader_"+index].name = index.toString();
                    tl["loader_"+index].contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,progressF);
                    tl["loader_"+index].contentLoaderInfo.addEventListener(Event.COMPLETE,completeF);
                    tl["loader_"+index].load(new URLRequest(swfA[index]));
    function progressF(e:ProgressEvent):void{
                    var fractionLoaded:Number = index/swfA.length+e.bytesLoaded/(e.bytesTotal*swfA.length);
                    preloader_mc.fill_mc.scaleX = fractionLoaded;
                    preloader_mc.tf.text = (100*fractionLoaded)+"% Loaded";
    function completeF(e:Event):void{
                    tl["loader_"+index].contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,progress F);
                    tl["loader_"+index].contentLoaderInfo.removeEventListener(Event.COMPLETE,completeF);
                    SoundMixer.stopAll();
                    var mc:MovieClip = MovieClip(tl["loader_"+index].content);
                    mc.gotoAndStop(1);
                    frameA.push(mc.totalFrames);
                    index++;
                    if(index<swfA.length){
                                    loadNextF();
                    } else {
                                    // all loads complete.  start play.
                                    restart_mc.buttonMode = true;
                                    restart_mc.alpha = 1;
                                    tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
                                    tl.removeChild(preloader_mc);
                                    preloader_mc = null;
                                    play_slider.enabled = true;
                                    playpause_mc.alpha = 1;
                                    currentLoader = tl["loader_0"];
                                    tl.addChild(currentLoader);
                                    MovieClip(currentLoader.content).play();
                                    sliderParamsF();

    import flash.events.MouseEvent;
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.events.ProgressEvent;
    import flash.events.Event;
    import flash.net.URLRequest;
    import fl.events.SliderEvent;
    import flash.media.SoundTransform;
    preloader_mc.fill_mc.scaleX = 0;
    var swfA:Array = ["part1.swf","part2.swf"];
    var frameA:Array = [];
    var currentLoader:Loader;
    var swfTotalFrames:int;
    var tl:MovieClip = this;
    var st:SoundTransform = new SoundTransform()
    var index:int = 0;
    loadNextF();
    play_slider.enabled = false;
    function loadNextF():void{
        tl["loader_"+index] = new Loader();
        tl["loader_"+index].name = index.toString();
        tl["loader_"+index].contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,progressF);
        tl["loader_"+index].contentLoaderInfo.addEventListener(Event.COMPLETE,completeF);
        tl["loader_"+index].load(new URLRequest(swfA[index]));
    function progressF(e:ProgressEvent):void{
        var fractionLoaded:Number = index/swfA.length+e.bytesLoaded/(e.bytesTotal*swfA.length);
        preloader_mc.fill_mc.scaleX = fractionLoaded;
        preloader_mc.tf.text = (100*fractionLoaded)+"% Loaded";
    function completeF(e:Event):void{
        tl["loader_"+index].contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,progress F);
        tl["loader_"+index].contentLoaderInfo.removeEventListener(Event.COMPLETE,completeF);
        SoundMixer.stopAll();
        var mc:MovieClip = MovieClip(tl["loader_"+index].content);
        mc.gotoAndStop(1);
        frameA.push(mc.totalFrames);
        index++;
        if(index<swfA.length){
            loadNextF();
        } else {
            // all loads complete.  start play.
            restart_mc.buttonMode = true;
            restart_mc.alpha = 1;
            tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
            tl.removeChild(preloader_mc);
            preloader_mc = null;
            play_slider.enabled = true;
            playpause_mc.alpha = 1;
            currentLoader = tl["loader_0"];
            tl.addChild(currentLoader);
            MovieClip(currentLoader.content).play();
            sliderParamsF();
    ///////////////// start sliders /////////////////////////////////
    sound_slider.addEventListener(SliderEvent.CHANGE,soundSliderF);
    function soundSliderF(e:SliderEvent):void{
        st.volume = e.value/100;
        tl.soundTransform = st;
    play_slider.addEventListener(SliderEvent.CHANGE,playSliderF);
    play_slider.addEventListener(MouseEvent.MOUSE_DOWN,playSliderDownF);
    //play_slider.addEventListener(MouseEvent.MOUSE_UP,playSliderUpF);
    function playSliderDownF(e:MouseEvent):void{
        tl.removeEventListener(Event.ENTER_FRAME,playUpdateF);
        stage.addEventListener(MouseEvent.MOUSE_UP,playSliderUpF);
    function playSliderUpF(e:MouseEvent):void{
        tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
    function playSliderF(e:SliderEvent):void{
        SoundMixer.stopAll();
        var frameNum:int = Math.ceil(swfTotalFrames*e.value/100);
        var partialTotalFrames:int = 0;
        for(var i:int=0;i<frameA.length;i++){
            partialTotalFrames += frameA[i];
            if(partialTotalFrames>=frameNum){
                break;
        partialTotalFrames -= frameA[i];
        //trace(i,frameNum,frameNum-partialTotalFrames);
        if(currentLoader!=tl["loader_"+(i)]){
            tl.removeChild(currentLoader);
            MovieClip(currentLoader.content).stop();
            currentLoader = tl["loader_"+(i)];
            tl.addChild(currentLoader);
        if(playpause_mc.currentFrame==1){
            MovieClip(currentLoader.content).gotoAndPlay(frameNum-partialTotalFrames);
        } else {
            MovieClip(currentLoader.content).gotoAndStop(frameNum-partialTotalFrames);
    function sliderUpdateF(e:Event):void{
        var playedFrames:int = 0;
        for(var i:int=0;i<Number(currentLoader.name);i++){
            playedFrames += frameA[i];
        playedFrames += MovieClip(currentLoader.content).currentFrame;
        play_slider.value = Math.round(100*playedFrames/swfTotalFrames);
    function sliderParamsF():void{
        swfTotalFrames = 0;
        for(var i:int=0;i<swfA.length;i++){
            swfTotalFrames += MovieClip(tl["loader_"+i].content).totalFrames;
    ///////////////// end  sliders //////////////////////////////////
    ///////////////// start playpause restart ///////////////////////
    playpause_mc.addEventListener(MouseEvent.CLICK,playpauseF);
    playpause_mc.alpha = .2;
    restart_mc.addEventListener(MouseEvent.CLICK,restartF);
    restart_mc.buttonMode = false;
    restart_mc.alpha = .2;
    function playpauseF(e:MouseEvent):void{
        if(!e.currentTarget.toggle){
            MovieClip(currentLoader.content).stop();
            tl.removeEventListener(Event.ENTER_FRAME,playUpdateF);
            e.currentTarget.gotoAndStop(2);
        } else {
            MovieClip(currentLoader.content).play();
            tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
            e.currentTarget.gotoAndStop(1);
        e.currentTarget.toggle = !e.currentTarget.toggle;
    ///////////////// end playpause //////////////////////////////
    function playUpdateF(e:Event):void{
        sliderUpdateF(e);
        var playingFrame:int = MovieClip(currentLoader.content).currentFrame;
        if(playingFrame==frameA[Number(currentLoader.name)]){
            // next loader
            MovieClip(currentLoader.content).stop();
            SoundMixer.stopAll();
            MovieClip(currentLoader.content).mute();
            var nextIndex:int = Number(currentLoader.name)+1;
            if(nextIndex<swfA.length){
                tl.removeChild(currentLoader);
                currentLoader = tl["loader_"+nextIndex];
                tl.addChild(currentLoader);
                MovieClip(currentLoader.content).gotoAndPlay(1);
            } else {
                tl.removeEventListener(Event.ENTER_FRAME,playUpdateF);
                playpause_mc.gotoAndStop(2);
                playpause_mc.toggle = !playpause_mc.toggle;
                //playpause_mc.alpha = .2;
                // all swfs have completed play
    function restartF(e:MouseEvent):void{
        MovieClip(currentLoader.content).stop();
        tl.removeChild(currentLoader);
        SoundMixer.stopAll();
        MovieClip(currentLoader.content).mute();
        currentLoader = tl["loader_"+0];
        tl.addChild(currentLoader);
        if(playpause_mc.currentFrame==1){
            MovieClip(currentLoader.content).gotoAndPlay(1);
        } else {
            MovieClip(currentLoader.content).gotoAndStop(1);

  • Can not load an external swf file from my site

    Hi ...
    I have a fla file which is loading external swf files from my local folders.
    I inserted some of the swf files to a web site and tried to load them from the site, not from my local folder...
    So it gave me a security error like below:
    *** Güvenlik Sanal Alanı İhlali ***security domain-area violation
    http://www.celiktek.com.tr/KIRIL.swf' SecurityDomain öğesi -- security domain element, 'file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf' uyumsuz bağlamına erişmeye çalıştı - tried to reach this incompatible url
    SecurityError: Error #2070: Güvenlik sanal alan ihlali -- security area violation: http://www.celiktek.com.tr/KIRIL.swf arayanı - searcher of this can not reach stage in file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf içindeki Stage'e erişemiyor. -
    at flash.display::Stage/requireOwnerPermissions()
    at flash.display::Stage/get numChildren()
    at KIRIL_fla::MainTimeline/frame1()
    so in my computer, I can load this swf , but how from a website ?
    thnx ...

    Thnaks ...
    I tried to use the securiyt panel that is openede and I added there my site
    www.celiktek.com.tr/KIRIL.swf
    but I still take the error
    *** Güvenlik Sanal Alanı İhlali ***
    http://www.celiktek.com.tr/KIRIL.swf' SecurityDomain öğesi, 'file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf' uyumsuz bağlamına erişmeye çalıştı
    SecurityError: Error #2070: Güvenlik sanal alan ihlali: http://www.celiktek.com.tr/KIRIL.swf arayanı file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf içindeki Stage'e erişemiyor.
    at flash.display::Stage/requireOwnerPermissions()
    at flash.display::Stage/get numChildren()
    at KIRIL_fla::MainTimeline/frame1()
    from my code
    var req:URLRequest=new URLRequest("http://www.celiktek.com.tr/KIRIL.swf");
    var lod:Loader=new Loader();
    lod.load(req);
    addChild(lod);
    lod.x=0;
    does this code works on your computer ... I know it is a weird question ... you dont have to try ...

  • Importing keywords from external file

    Is there any way to import keywords from a text file into Aperture to automatically tag images? For example, if I have a spreadsheet with a list of names and numbers can I enter the image numbers in the spreadsheet (on the iPhone) and then import that data to the Aperture album with the images. Kinda like a merge of the data.

    Entry Number
    Name
    Image Number Start
    Image number stop
    1
    John Doe
    DSC_001
    DSC_003
    2
    Bob Smith
    DSC_004
    DSC_006
    3
    Betty Sue
    DSC_007
    DSC_009
    I am thinking something like this. however, I would have the first two columns and would enter the image numbers.
    Or like this
    Entry Number
    Name
    Image Number
    1
    John Doe
    DSC_001
    1
    John Doe
    DSC_002
    1
    John Doe
    DSC_003
    2
    Bob Smith
    DSC_004
    2
    Bob Smith
    DSC_005
    2
    Bob Smith
    DSC_006
    3
    Betty Sue
    DSC_007
    3
    Betty Sue
    DSC_008
    3
    Betty Sue
    DSC_009

  • Trying to properly code a menu with buttons that can go back and forth between external swf files

    I have a project I've been working on that, when properly coded, has a "main menu" with 4 "doors" (buttons). When the corresponding buttons to these "doors" are clicked, it should go to and play an external .swf file. If that doesn't make sense, think of a DVD menu. You click play movie, it plays the movie. When the movie is over, there's two buttons on that swf file to either play the movie over or go back the main menu, which is an external .swf file (Remember, we go to the movie from the menu, which is a seperate file). So far, the buttons work. The menu works. However, from the movie, at the conclusion, when I click the button to go back to the main menu, it displays the movie clip and the buttons, but none of the buttons work. I'm starting to think it has to do with the fact the main menu was written in AS3 and the movie was made in AS2. If anyone can assist me in being to able to keep both files and still navigate between the two, being able to bring up the menu from the movie and be able to play the movie again, and so on and so on, that'd be GREAT. I'm somewhat of a noob to Flash, but I learn quickly and I'm open to any suggestions. Here's the code for main menu, which I guess acts as the parent file, and the movie. If I get this to work, I essentially would duplicate the same actions for the other 4 doors, once I complete the environments for them. Thanks
    Main.Fla/Swf (written in AS3)
    (This is the action on the first frame, that has all the buttons. For this question, I'm just trying to properly code for 'Door4', which is the "door" to the movie.)
    import flash.display.Loader;
    stop();
    var myLoader1:Loader=new Loader ();
    Door4.addEventListener(MouseEvent.CLICK, jayzSwf);
    function jayzSwf(myevent1:MouseEvent):void
              var myURL1:URLRequest = new URLRequest("jayzspeaks.swf");
              myLoader1.load(myURL1);
              addChild(myLoader1);
              myLoader1.x = 0;
              myLoader1.y = 0;
    Movie.Fla/Swf (written in AS2)
    (This is action on the button that returns to the menu)
    on (release) {
              this.createEmptyMovieClip("container",this.getNextHighestDepth());
              container.loadMovie("main.swf");

    At least you're going in the correct (mis)direction. You have AS3 loading AS2. So that's not a huge hurdle.
    I believe all you really need to do is send your Main.swf a signal that the content it loaded (e.g. jayzspeaks.swf) is done and you want to get rid of it.
    The code I pointed you to asks you to (upon download and import then) instantiate it in both AS2 and AS3. They give a very simple easy to understand line of code.
    // as2, load this in jayzspeaks.swf
    var myBridge:SWFBridgeAS2 = new SWFBridgeAS2("connectionID", clientObj);
    // as3, load this in main.swf
    var myBridge:SWFBridgeAS3 = new SWFBridgeAS3("connectionID", clientObj);
    Make sure the connectionID matches between them. Set it to whatever you want.
    When you're done with your as2 loaded content you'd send a signal (over localconnection) back to the AS3 Main like they say:
    myBridge.send("someFunctionToUnloadContent");
    myBridge.close();
    You'd need to make the as3 function "someFunctionToUnloadContent()" (example purposes only name) and it should unload the jayzspeaks.swf that was loaded in the loader.
    Make sure you get that close in there so you don't drill up a bunch of localconnection objects just like the simple source code says.

  • Loading library assets from external .swf

    Ok, so here's what I want to do. I'm creating an application
    that has optional classes that it can instantiate based on what the
    needs are. These classes operate things like Session Logging
    utilities, etc. These items obviously have assets that they need
    available such as movieclips and buttons. For example, the Session
    Logger has a sessionLog_mc clip that has a log window with buttons
    and the log display. I want to be able to have my class load the
    external .swf that contains the assets for the Session Logger and
    then use attachMovie(), once the .swf is loaded, to attach the
    sessionLog_mc from the library of the loaded external .swf file.
    This does NOT seem to work at all. This seems like it has to be
    possible. I don't want to be forced to put all my code into
    external .swf's too. I just want some external asset .swf's (or
    maybe just one large one) that I can load. Is this possible? I am
    wanting to have the ability to show the progress of loading each of
    these components while the application is starting up and loading
    the asset files. Thanks so much!
    Here is an example of what I'm trying: (the attachMovie does
    NOT work at all)

    I see now how to import and display a library class object
    using:
    var MovieClipClass:Class =
    Class(loader.contentLoaderInfo.applicationDomain.getDefinition("myLibraryAsset"))
    var movieClip:Sprite = new MovieClipClass();
    addChild(movieClip)
    But this seems to only work for SWF's published for AS3 Flash
    Player 9.
    I need to do the same for SWF's published with AS2 Flash
    Player 7.
    Any ideas?

  • How can I control a button from one swf file to another swf file?

    Hi,
    I have a main.swf file. From that file I am accessing the external.swf file which is an external file.
    Now, how can I write code on my main.swf file for the button which is on my external.swf file?
    Activities.MainPanel.close_btn.addEventListener(MouseEvent.CLICK, btnClickClose);
    Activities.MainPanel.close_btn (This buttons is actually on external.swf file, but I want to write code on main.swf file to execute it on external.swf) how can I control one swf button on other swf file?
    Thanks.

    Here's some example code that you should be able to adapt to your needs.
    // create a new loader object instance...
    var loader:Loader = new Loader();
    // make the download request...
    var request:URLRequest = new URLRequest("external.swf");
    // add a complete event listener to the loader
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
    // start the actual loading process...
    loader.load(request);
    // create a new empty movieClip instance, you will put the loaded movie into this movieClip once its loaded
    var externalMovie:MovieClip;
    // this function is called when the download has finished and the file is ready to use...
    function completeHandler(event:Event):void {
       // set the contents of the loaded movie to the new empty movieClip...
               externalMovie = MovieClip(event.target.content);
       // add this new movie to the display list...
       addChild(externalMovie);
    Now you can refer to the loaded movie with the instance name "externalMovie". So if, for instance, you want to address a button in the loaded movie, you could write something like this on the main timeline:
    externalMovie.addEventListener(MouseEvent.CLICK, btnClickClose);
    function btnClickClose(event:MouseEvent):void {

  • FAQ: How do I load an external SWF file into a parent SWF file?

    A ton of Flash users visit Adobe’s we site every month wondering  about how to load an external SWF file from within another SWF.
    Adobe's own TechNote on the subject attempts to answer the basic question, along with some common follow-up questions, including:
    How do I load more than one SWF?
    How do I load a SWF into a specific location in the display list?
    How do I resize the loaded SWF?
    How do I set its X and Y location?
    Here are some additional resources that elaborate on loading content and on working with the display list:
    Sample files for the above TechNote. A set of 3 FLA and 3 corresponding SWF files, including a parent SWF and 2 SWFs that the parent loads.
    Help > AS3 Developer’s Guide > Loading an external SWF file
    Help > AS3 Developer’s Guide > Loading display content dynamically
    Loading multiple external SWFs within a main SWF – CreativeCow.net forums
    Video tutorial: ActionScript 101 – Episode 6: Adding named objects to the Stage. By Doug Winnie. An example of how to add the loaded external asset to the Stage and modify its location or other properties.
    Video tutorial: Preloading in ActionScript 3.0.  By Lee Brimelow. A slightly more complicated example, showing how to  make the parent SWF display information about the progress of loading  the external SWF.
    Tutorial: Loading and unloading SWFs - FlashAndMath.com
    This article provides several examples of how to communicate between a parent SWF file and the loaded SWF:
    SWF to SWF Communcation via ActionScript 3.0 (by kglad)

    quote:
    Originally posted by:
    NedWebs
    You now seem to want to get rid of the swf once it has loaded
    and played itself thru. To do that you would need to have something
    in the swf itself that triggers its removal in its last frame. The
    following might work...
    MovieClip(this.parent).removeChild(this);
    Unfortunately I couldn't get this to work. I placed it on the
    last frame of the SWF to be called - is that right?
    I am not sure I am doing it correctly...

  • Using HTTPService to import data from a XML file

    Hello there!
    I'm having some problem's with this import... If anyone can
    help, I would appreciate it!
    I'm using this type of information as data source:
    public var dataCollection:ArrayCollection =
    new ArrayCollection([
    { id: "P1", name: "Porto", type: "team", children: [
    { id: "R1", name: "Dr Silva", location: "Bloco 1", type:
    "member" },
    { id: "R2", name: "Dra Neto", location: "Gabinete", type:
    "member"
    { id: "P2", name: "Braga", type: "team", children: [
    { id: "R3", name: "Dr Santos", location: "Bloco 2", type:
    "member" },
    { id: "R4", name: "Dra Sonia", location: "Piso 1", type:
    "member"
    But I want to import it from a XML file like this:
    <?xml version="1.0" encoding="utf-8"?>
    <items>
    <item id="P1" name="Porto" type="team">
    <children id="R1" name="Dr Silva" location="Bloco 1"
    type="member" />
    <children id="R2" name="Dra Neto" location="Gabinete"
    type="member" />
    </item>
    <item id="P2" name="Braga" type="team">
    <children id="R3" name="Dr Santos" location="Bloco 2"
    type="member" />
    <children id="R4" name="Dra Sonia" location="Piso 1"
    type="member" />
    </item>
    </items>
    I already import the file, but can not translate the data
    into a array collection.
    private function initApp():void {
    var httpService:HTTPService = new HTTPService();
    httpService.url = "dataprovider.xml";
    httpService.resultFormat = "e4x";
    httpService.addEventListener(FaultEvent.FAULT,
    onFaultHttpService);
    httpService.addEventListener(ResultEvent.RESULT,
    onResultHttpService);
    httpService.send();
    private function onFaultHttpService(e:FaultEvent):void
    Alert.show("Error reading data file.");
    private function onResultHttpService(e:ResultEvent):void
    //Convert the xml data to a array collection
    Thank you

    Hello Peter, and thank you for your reply's.
    My problem is that I'm receiving the data from the external
    file and I don't know how to get the children in place... I mean, I
    also have some data being received form a file that I can convert
    into an array collection, but the thing is, that file doesn't have
    children structure...
    It's something like this:
    <?xml version="1.0" encoding="utf-8"?>
    <items>
    <item id="T1" resourceId="R1" name="Cardiologia"
    startTime="25-3-09 8:0:0" endTime="25-3-09 8:30:0" />
    <item id="T2" resourceId="R2" name="Raio-X"
    startTime="25-3-09 9:0:0" endTime="25-3-09 9:15:0" />
    <item id="T3" resourceId="R3" name="Analises"
    startTime="25-3-09 12:0:0" endTime="25-3-09 12:45:0" />
    <item id="T4" resourceId="R4" name="Consulta"
    startTime="26-3-09 8:0:0" endTime="26-3-09 9:0:0" />
    </items>
    And I solve it with this (don't know if is the best):
    private function onResultHttpServiceTask(e:ResultEvent):void
    var a:Array = xmlListToObjectArray(e.result.item);
    tasks = new ArrayCollection(a);
    protected function
    xmlListToObjectArray(xmlList:XMLList):Array
    var a:Array = new Array();
    for each(var xml:XML in xmlList)
    var attributes:XMLList = xml.attributes();
    var o:Object = new Object();
    for each (var attribute:XML in attributes)
    var nodeName:String = attribute.name().toString();
    var value:*;
    value = attribute.toString();
    o[nodeName] = value;
    a.push(new ObjectProxy(o));
    return a;
    But when the children "enter in action" I don't know how to
    bring them to the array...
    This code you send it's preaty much the thing I need, but the
    thing is that I don't know how to call the children with data as
    e:ResultEvent...
    If you can help a bit more, I would really appreciate...
    Thank You

  • Remove external swf file

    I have loaded an external swf file which plays a flv file by default as swf is loaded. Now the problem is how do i remove the swf file from memory. my code :
        var myLoader:Loader = new Loader();                    
        var url:URLRequest = new URLRequest("ExternalSWF.swf"); 
        myLoader.load(url);                                    
        detailMovieClip.movieHolder.addChild(myLoader);
    I have tried many combinations of removeChild, unload and unloadAndStop but none works. I figure its all about not referencing correctly.

    Hi Jah,
    i understood your problem,i faced this problem many time but couldn't find correct solution.
    I'm using now Event.REMOVED_FROM_STAGE. this method dispatch to parent swf for when the External swf removed from stage.
    The sample example code below for the way of remove externalswf events:
    parent swf actionscript code:
    import flash.events.MouseEvent;
    var myLoader:Loader = new Loader();                   
    var url:URLRequest = new URLRequest("ExternalSWF.swf");
    myLoader.load(url);                                   
    b_mc.addChild(myLoader);
    a_mc.addEventListener(MouseEvent.CLICK,onClick);
    function onClick(event:MouseEvent):void
        a_mc.removeEventListener(MouseEvent.CLICK,onClick);
        myLoader.unload();
        b_mc.removeChild(myLoader);
        myLoader=null;
    ExternalSWF.swf actionscript code:
    import flash.events.Event;
    var num:Number=0;
    addEventListener(Event.ENTER_FRAME,onRun);
    addEventListener(Event.REMOVED_FROM_STAGE,onRemoveFromParent);
    // remove all local events here//
    function onRemoveFromParent(event:Event):void
        trace("remove");
        removeEventListener(Event.ENTER_FRAME,onRun);
    function onRun(event:Event):void
        num++;
        trace(num);
    Thanks/

  • Access a component inside external swf file

    Hi, I loaded a external swf file that it is a dialog.
    var swfLoader : Loader = new Loader();
    var swfURL : URLRequest = new URLRequest("dialog.swf");
    swfLoader.load(swfURL);
    swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,imgLoaded);
    function imgLoaded(event:Event):void
    var movie : * = swfLoader.content;
    var clip : MovieClip = movie;
    parent.addChild(clip);
    Now, inside the movieClip there is a TextField component
    named message that i want to change its 'text' property.
    The question is: How can i access to this property to change
    it?
    Regards

    okay,
    I have the image component in ProductCatalogThumbnail.mxml, which has an id of "img"
    so, i created a public variable in the file and a public function that returns the value of the object.
    public var imagecopy:Object;
            [Bindable]
             public function imagecopyfunction():Object{
             imagecopy  = img;
             return imagecopy;
    now, I want to access this image in the mxml file ProductList.mxml in a function
      public function init():void
          ProductCatalogThumbnail.imagecopy.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
         // accepting a drag/drop operation...
           this.area.addEventListener( DragEvent.DRAG_ENTER, acceptDrop );
           // handling the drop...
          //this.area.addEventListener( DragEvent.DRAG_DROP, handleDrop );
    I tried to use the variable, and then i tried to use the function:
    I got this error when I tried the variable : 1119: Access of possibly undefined property imagecopy through a reference with static type Class.
    ProductCatalogThumbnail.imagecopy.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
    and this error when i tried the function:  1061: Call to a possibly undefined method imagecopyfunction through a reference with static type Class.
    ProductCatalogThumbnail.imagecopyfunction().addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
    i made sure i imported ProductCatalogThumbnail file in the beginning of my application.
    I am not sure what went wrong.

  • Loading font from external *.swf

    So!
    I have 3 movies.
    1)Main movie - index.swf
    2)Movie with created & checked in linkadge "Export for
    runtime sharing" fonts in library - fonts.swf
    3)movie with text fields which need embeded fonts to work in
    a proper way. Fonts in the library checked in linkage as "import
    for runtime sharing" - content.swf
    What happens:
    I strike CTRL+ENTER and run movie index.swf.
    on the (for ex.) 10 frame it loads fonts.swf with
    movieClipLoader class..
    then in the same way on (for ex.) 100 frame, i load content
    swf
    BUT!!! before it starts loading process IT DOWNLOADS FONT.swf
    again
    SO HOW DO I PRELOAD fonts from external *.swf..
    maybe there is yhe way without using runtime sharing..
    but i've heard that loaded whith movieClipLoader movies don't
    adds objects from their library to main movie liblary...
    HOW DO I SOLVE THIS PROBLEM!

    can you give your erroe source code,and then i will give you the success code.
    in the function
    private function onLoadComplete(e:Event):void {}
    ApplicationDomain.currentDomain.getDefinition("com.scottgmorgan.ExternalMovie") ;
    use like this:
    var EMClass:Class=loader.contentLoaderInfo.applicationDomain.getDefinition("com.scottgmorgan.ExternalMovie") ;
    then you can new a instance :
    var emInstance:Object=new EMClass();
    emInstance.alert("hello word");
    and we also can use other method. so email me  [email protected]

  • Embedding external swf file flash.

    Hi,
         I have 1 swf file which generated through 3rd party tool.
    Now I want to embed this file into empty flash file and want to save as new, I tried with following options,
    1) import option ( File > Import ) but it is importing only Images and symbols. I want my original file as it in new file.
    2) loader.load(), but this will load my external file at runtime only and to work smoothly it require both the files.
    I want same but in design time, so I can add some extra functionality to it.
    Is it possible to embed external swf file as it is in new flash file in CS4?
    Thanks in advance.
    Ganesh

    When you import swf files into fla files they lose all actionscript/functionality.  The only way to add it to the new file is to copy the timeline of the file into the new file.  Since you probably do not have a file where you could copy this from, then your only options are to load the file during runtime, or take what the import gives you as far as parts go, and design in the functionality yourself.

  • Loading external swf files in a swf - Error#1009

    I have been having trouble using a swf file within a swf file.   The external swf files all work as expected.  However when used within another swf file I get the standard TypeError #1009 for some of my swfs.   The external swf files are mainly actionscript 3 files.  A typical swf file will have an object (or objects) in the library which has an export for ActionScipt property enabled and an addEventListener(Event.ENTERFRAME, somefunction).   About four years ago when I had to do some work with AS2 I seemed to get around a similar issue with the _lockroot method but this is no longer part of AS3. I have searched various forums and note that I am not the only one with this issue but did not find any relevant solutions.   If anyone could give me any ideas on how to get around this it would be appreciated.
    Regards
    Norman

    Hi,
    I have added a download to rapidshare and its link is:
    Download link: http://rapidshare.com/files/380202712/ExtSwfs.zip
    The main file Training01.fla has been set up with links to download several swf's.   The links that do not work properly are those labelled :  Module6 and Module 8.   The first Module 6 connects to a function that is a variation of how I was trying to load external swfs using Application Domain, while Module 8 is a link to a swf that uses and external class.  Module 8 is supposed to load with rotating stars, while Module 6 loads the same file as the link called Module 1.   As soon as I use the two links Module 6 or Module 8 the whole lot ceases to work properly.  I did also follow through the examples on the Adobe site.  The examples for Module 6 and Module 8 are tutorials I have used from the Internet as part of my training from the site FlashMyMind.com but they replicate the type of work we have been doing with respect to using ActionScript3.
    Re my background, at this stage I am self-taught using tutorials on the web and whatever books I can lay my hands on here.  There is no structured training available where I live as there is insufficient demand and no books available on Flash or ActionScript at the local book stores or libraries so the books are ones I have ordered via the Internet.  The one I am currently using apart from Adobe Classroom in a Book Flash CS4 is O'Reilly's Learning ActionScript 3.0 a Beginners Guide.
    The other problem I have been trying to solve and still researching is why one loses sound in the flash player when playing flv files, if the user has selected or restarted a video (or videos) many times eg 25 to 30 times as we create video training files and serve them to the user within the flash environment using Flash Player 9 and IE6.
    Regards
    Norman

Maybe you are looking for