AS3: using external swf buttons

Hello

I'm doing a Web site in Adobe Flash that imports an external swf file s navigation buttons.

The problem is how my FLA file main know that the navigation buttons users urged, because the buttons and eventListeners are in the external swf file.

With the other Word: can I make my external swf file returns a number to my website FLA file, to determine which button was pressed? If so, how?

Here are the different has your two sovereigns can communicate:

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

Tags: Adobe Animate

Similar Questions

  • Is it possible to use external SWF library assets loaded?

    I have a main SWF (what I call a wrapper). This wrapper must simply 3 buttons which load 3 separate films in the main stage. Each button contains a small excerpt of the text and a thumbnail.
    The 3 external loaded all use txt files of the SWF file to set text variables.

    What I hope to do is to load variables and/or the external swf symbols in the wrapper. This way I can fill the thumbnail/text snipped by external assets to eliminate the need for separate files/images to load just for the wrapper.

    Let me know if I'm not being clear. :)

    Don't worry, I found the answer:

    Shared libraries

  • Hello. Is it possible that I can call an external swf button?

    I create a game and I want to call a button from an external swf object. Is this possible?

    If the file is not responsible he cannot do anything to the file which is an impact.

  • External SWF

    Hello, everyone!

    I have some problems using external swf.

    In fact, loading swf and access to its classes have no problem. Let's call a SWF that loads another - 'HAND'.

    public var GAME_LIB:LoaderContext;
    private function LOAD_GAME_LIBRARY()
    {
         var GAME_LIB_LOADER:Loader = new Loader();  
         GAME_LIB = new LoaderContext();  
    
         var request:URLRequest = new URLRequest("EXTERNAL.swf");  
         GAME_LIB_LOADER.contentLoaderInfo.addEventListener(Event.COMPLETE, GAME_LIBRARY_LOADING_COMPLETED);  
         GAME_LIB_LOADER.load(request, GAME_LIB);  
    }
    
    private function GAME_LIBRARY_LOADING_COMPLETED(e:Event):void
    {  
         var tmp_class:Class = GAME_LIB.applicationDomain.getDefinition("ZZZ") as Class;
         var myMC:MovieClip = new tmp_class() as MovieClip;
    } 
    

    The question is:

    responsible for access to the classes of the swf 'HAND' to 'EXTERNAL.swf '? I want access to the classes of the 'HAND' loading code "EXTERNAL.swf". "» So ' HAND ' a sth in his library, I would like to call "new SMTH()" in the code of "EXTERNAL.swf" and get that smth from this GREAT library

    Sorry for my English.

    The problem is:

    This new SMTH, called EXTERNAL.swf, should be added as child in hm... HAND root, not EXTERNAL

    I have found no easier way but creating public var externally and passing HAND stage.root to it.

    externally:

    public var GAME_ROOT:*;
    public function ADD_SMTH()
    {
         var tmp_class:Class = getDefinitionByName("ZZZ") as Class;
         GAME_ROOT.addChild(new tmp_class() as MovieClip);
    }
    

    in HAND:

    public var GAME_LIB:*;
    private function GAME_LIBRARY_LOADING_COMPLETED(e:Event):void
    }
         GAME_LIB = e.currentTarget.content;
         GAME_LIB.GAME_ROOT = stage.root;
         GAME_LIB.ADD_SMTH();
    }
    

    So, this is how to make new SMTH() from the OUTSIDE.

    Main SWF will load external swf, then external code in swf will add class to hand library at the root of the hand.

    Problem solved. Thank you, kglad

  • With the help of a button to load and unload the external SWF in AS3?

    How can I use a button to load and unload a sequence of external SWF files, as a Next button and previous?

    I don't know if it will work because apparently you are trying to load a swf AS1/2, but try

    change the line to be...

    _swfTempClip = MovieClip (event.target.content);

    If this does not work, then you will need to create _swfTempClip as a new MovieClip and add the event.target.content to this MovieClip using addChild().

  • Loading external SWF in as3 SWF Loader style?

    Hello

    I recently did the replacement of as2 as3 and am still struggling to get my head to a particular aspect. I managed to load an external swf into an empty file via the script

    Import LoadDisplayObject;

    var loader: LoadDisplayObject = new LoadDisplayObject ("button_01.swf", true);

    1. loader.addEventListener ("displayObjectLoaded", onComplete, false, 0, true);

    addChild (loader);

    function onComplete(evt:Event):void {}

    trace ("received full load");

    loader.scaleX = loader.scaleY is. 75;

    }

    ... but I'm struggling with the script to make a SWF to load into a space when one of my 3 buttons is activated...

    My page currently has three buttons (button_01, button_02 and button_03) and in a local folder three separate sovereign wealth funds with the same names that I want to load, when you press the appropriate button.

    I managed to get them to load using a tutorial... but what they charge on top of each course... far from ideal. Research on the internet I found a range of different script... goal, that I can't find anywhere that I can find the script to make it work... so why I turned here.

    Any help much appreciated... Thanks in advance.

    Simply call butt1Click (null);

  • Difficulty to connect buttons with external swf...

    I'm working on trying to combine external navigation with swf buttons. Essentially, I've included the navigation (mask, buttons, scripts, etc.) in the main scenario and I'm trying to implement the buttons to load external SWFs right in the main timeline as well.

    I think that the problem is related to the instance names and the reference in the AS3 code, but I can't quite figure out how to fix.  I apologize for what is amateur, but I'm still very early in this learning process.

    Error messages:

    Scene 1, Layer 'AS3', frame 20, line 21 1120: access of undefined property newSWFRequest.

    Scene 1, Layer 'AS3', frame 20, line 22 1120: access of undefined property xPos.

    Scene 1, Layer 'AS3', frame 20, line 23 1120: access of undefined property yPos.

    Scene 1, Layer 'AS3', frame 20, line 10 1120: access of undefined property newSWFRequest.

    Scene 1, Layer 'AS3', frame 20, line 11 1120: access of undefined property xPos.

    Scene 1, Layer 'AS3', frame 20, line 12 1120: access of undefined property yPos.

    AS3:

    Stop();

    var Xpos:Number = 106;
    var Ypos:Number = 146;
    var swf:MovieClip;
    var loader: Loader = new Loader();

    var defaultSWF:URLRequest = new URLRequest("swfs/startGallery.swf");

    Loader.Load (defaultSWFRequest);
    Loader.x = XPos;
    Loader.y = YPos;
    addChild (loader);

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

    function btnClick(event:MouseEvent):void {}

    removeChild (loader);
    var newSWF: URLRequest = new URLRequest ("SWFs /" + event.target.name + ".swf");
    Loader.Load (newSWFRequest);
    Loader.x = XPos;
    Loader.y = YPos;
    addChild (loader);

    }

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

    as_Wedding.addEventListener (MouseEvent.Click, btnClick);
    ej_Wedding.addEventListener (MouseEvent.Click, btnClick);

    Any help would be greatly appreciated.

    Kind regards

    SP

    The error messages are simple enough to what is the problem.  None of these three properties are defined in your code - use you them, but they are not the ones you have defined.  Check your spelling/denomination.

  • How can I load an external .swf into my step by pressing a button?

    Hello world...

    I have to add an external swf in a specific position in my scene by pushing a button.

    Comeon can help me?

    Thank you.

    using as3, assuming you have a button named "myButton":

    var myLoader:Loader = new Loader(); something to load the swf file

    myButton.addEventListener (MouseEvent.CLICK, loadSWF); Earphone for your button click

    function loadSWF(event:MouseEvent):void {}

    listener for when the charge is complete

    myLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, addSWF);

    load the SWF - using your url of course

    myLoader.load (new URLRequest ("yourSWFsURL.swf"));

    }

    function addSWF(event:Event):void {}

    var mySwf = myLoader.content; the thing charge charger

    mySwf.x = 100; anywhere in x

    mySwf.y = 100; anywhere in there

    addChild (mySwf); Add it to the stage

    }

    HTH,

    -Ted

  • AS3 external swf close self

    Hello

    After looking through the forums online and video tutorials...

    I am always facing errors of loading an external swf into my main swf (full step width).

    In my main.swf... i have several scenes.

    On one of these scenes, I have an external SWF that loads my main.swf step size.

    Which works very well...

    BUT

    I now want to close the external swf on a button (in my external swf) and to return to one of my scenes in my hand. SWF

    I read many forums that talk about dispatchEvent

    I tried these methods and I am still facing errors.

    I want just one button on my external.swf that is farm/unloads/deletes itself... so that the user can continue by HAND. SWF after that they played OUTSIDE. SWF.

    in actionscript 2, it was a breeze.

    in as3, it's a useless pain in my rectum

    Sorry if I've missed a lot

    any help would be appreciated

    jayquery

    Try to change the code of loader main file for more like the following (blue nine):

    var defaultSWF:URLRequest = new URLRequest ("gametestG.swf");

    var loader: Loader = new Loader();
    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, loaderCompleteHandler);
    Loader.Load (defaultSWF);

    function loaderCompleteHandler(evt:Event):void {}
    MovieClip (evt.target.content) .addEventListener ("closeChild", onChildClose);
    addChild (loader);
    }

    function onChildClose(event:Event):void {}
    loader.unloadAndStop ();
    removeChild (loader);
    }

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

    }

  • How to make reference to the external SWF file using if statement?

    I have a main swf file that loads several external SWF file when the user clicks a menu button. Now I want to target a specific swf file to Add an extra library child or of another swf when this specific swf file is loaded. How should I do? What should I put in the stated case?

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

    var newswf:URLRequest = new URLRequest (".") ("/ swf /" + event.target.name + ".swf");

    Loader.Load (newswf);

    addChild (loader); dynamically load SWFs

    If (newswf == ".") ("/ SWF/pubResCHETNA.swf ') //error here

    {

    FC.buttonMode = true;

    FC.addEventListener (MouseEvent.CLICK, full screen);

    }

    function fullScreen(e:MouseEvent):void

    {

    var loaderF:Loader = new Loader();

    loaderF.load (new URLRequest ("PopupFullscreen.swf"));

    addChild (loaderF);

    }

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

    The State must be newswf.url == the path. However I store event.target.name as a variable and use it in the State. You use "." for your path so the condition probably will always fail.

    --

    Kenneth Kawamoto

    http://www.materiaprima.co.UK/

  • Unloading of an external SWF that is loaded with a close button on the external SWF to unload

    I found a discussion on this topic, but I still have problems to work and was hoping to get some help here.

    Here, I have a file: http://www.dril-quip.com/test/main.swf

    I: main.swf (menu) and I module.swf (content)

    If you go to the wellhead systems/SS-15 BigBore II submarine and click on I have to load an external swf which covers most of the parent company.

    So far so good. My problem drains the loaded swf to 'Child' with the button provided on the loaded swf to 'Child'.

    Here is the code that I used to upload the file but I can't, for the life of me, find a way to unload.

    var bigboreLoader:Loader = new Loader();
    btnbb2.addEventListener (MouseEvent.MOUSE_UP, bigborecontent);

    function bigborecontent(event:MouseEvent):void {}
    var bigboreRequest:URLRequest = new URLRequest ("moduletemplate.swf");

    bigboreLoader.load (bigboreRequest);
    stage.addChild (bigboreLoader);

    I am sure that it requires the child to communicate with the parent somehow, but I'm at a loss. If I could get a bit of advice or a link to something to deal with this, it would be a great help. I just need to have my links loading my modules and remove it when the narrow buttong is struck on the loaded swf file. I promise you that I did some research and I confess that I found asnwers, but still they do not work. I found the code below:

    Main FLA:

    function removeF() {}

    removeChild (bigboreLoader);

    }

    var bigboreLoader:Loader = new Loader();
    btnbb2.addEventListener (MouseEvent.MOUSE_UP, bigborecontent);

    function bigborecontent(event:MouseEvent):void {}
    var bigboreRequest:URLRequest = new URLRequest ("moduletemplate.swf");

    bigboreLoader.load (bigboreRequest);
    stage.addChild (bigboreLoader);

    EXTERNAL FLA:

    btnClose2.addEventListener (MouseEvent.CLICK, bigborecontent);

    function bigborecontent(myevent:MouseEvent):void {}

    MovieClip (parent.parent) .removeF ();

    }

    I think I have a poor understanding of the code. Thanks for any help you might be able to provide.

    again, this code should all be on the same timeline as btnbb2. in main.fla.

    var bigboreLoader:Loader = new Loader();
    btnbb2.addEventListener (MouseEvent.MOUSE_UP, bigborecontent);


    function bigborecontent(event:MouseEvent):void {}
    var bigboreRequest:URLRequest = new URLRequest ("moduletemplate.swf");
    bigboreLoader.load (bigboreRequest);
    addChild (bigboreLoader);

    }

    function removeF() {}

    removeChild (bigboreLoader);

    }

    /////////////////////// end main.fla code ///////////////////////////////////////

    This code should all be on the main timeline in FLA EXTERNAL.

    and btnClose2 should be placed on the main timeline in your external fla. //

    btnClose2.addEventListener (MouseEvent.CLICK, bigborecontent);

    function bigborecontent(myevent:MouseEvent):void {}

    MovieClip (parent.parent) .removeF ();

    }

    end external fla code.

  • AS2 button table to load external swf files

    Hey everybody.  Someone here recently helped me tremendously with a question I had on the creation of a back button in my flash file, allowing the user to click the button and view the file before swf.  I hope someone can help me make the next button now, too.

    I have a movieclip that loads an external swf files table.  I thought that the next button would be as simple as changing a selection just few things for the previous button.  However, this does not work.  When I try it, the movieclip doesn't even load the swf files.  Here's my AS2 code for my folder.  I have bolded the part at the end is for the previous button.  Does anyone know how to make the back button?

    var currentSwf:Number = 0;
    var swfs:Array = new Array ("EZSmartStand/SmartStand.swf", "EZSmartStand/Warnings.swf", "EZSmartStand/LCDDisplay.swf", "EZSmartStand/Operation.swf", "EZSmartStand/Harness.swf", "EZSmartStand/Transferring.swf", "EZSmartStand/800lbvid.swf", "EZSmartStand/Ambulating.swf", "EZSmartStand/Accessories.swf", "EZSmartStand/HarnessLaundering.swf", "EZSmartStand/ChargingBatteries.swf", "EZSmartStand/EmergencyLowering.swf", "EZSmartStand/EmergencyLowering2.swf");

    var listener: Object = new Object();
    var mcl:MovieClipLoader = new MovieClipLoader();
    mcl.addListener (listener);

    Function to load the film "next".  It uses the current value of currentSwf
    to access the table of sovereign wealth funds, then increments this value.  This version loops
    around at the beginning after the last of them.

    function loadNext (): Void {}
    mcl.loadClip (SWF [currentSwf], theTargetClip_mc);
    currentSwf ++;
    If (currentSwf > = swfs.length) currentSwf = 0;
    }

    When the SWF load, put in place to constantly check its current image
    against the total number of frames, and so those that match, the SWF is done playing.
    If this is the case, then load the following.

    listener.onLoadInit = {function(targ:MovieClip):Void}
    theTargetClip_mc.onEnterFrame = function (): Void {}
    If (this ._currentframe = this ._totalframes) {}
    loadNext();
    delete this.onEnterFrame;
    }
    }
    }

    loadNext();
    function loadNext (): Void {}
    If (currentSwf > = swfs.length) return;
    mcl.loadClip (sovereign wealth funds [currentSwf], theTargetClip_mc);
    currentSwf ++;

    }

    function loadPrevious (): Void {}

    if(currentSwf>1) {}


    currentSwf-= 2;


    loadNext();


    }


    }

    rewind_btn.onRelease = loadPrevious;

    You must change your code so that the value of currentSwf reflects the real current swf being viewed.  It makes it easier to manage in the aspect of thinking.  While I'm not show all your code, here's how I recommend you change functions, by adding one specifically for loading, and change the other just increment/decrement the value currentSwf.

    function loadNext (): Void {}
    currentSwf ++;
    If (currentSwf > = swfs.length) currentSwf = 0;
    loadSWF (currentSwf);
    }

    function loadSWF (nextSWFToLoad) {}
    mcl.loadClip (SWF [nextSWFToLoad], theTargetClip_mc);
    }

    loadSWF (currentSwf);

    function loadPrevious (): Void {}
    -currentSwf;
    if(currentSwf==-1) currentSwf = swfs.length - 1;
    loadSWF (currentSwf);
    }

    rewind_btn.onRelease = loadPrevious;

  • External SWF load on buttons

    Hi all..

    I am loading a SWF file outside on click of a button, however, when the external SWF file loads, it covers the buttons... Can someone help me please on how I can keep the buttons on the top? I even tried the external SWF to load in a clip and place the buttons on a layer above - and it does not work... Any help would be great appreciated. Thank you advance!

    Here is my code:

    Table external to use staples. Variable index refers to the next clip is displayed.
    var clip: Array = ["page1.swf", "page2.swf", "page3.swf"];
    var int index = 0;

    Stuff to load swf files
    var thisLoader:Loader = new Loader();
    thisLoader.contentLoaderInfo.addEventListener (Event.INIT, doneLoading);

    var thisMC:MovieClip = new MovieClip();
    stage.addChild (thisMC);            Add MC initially empty so that the nextClip function can be generic

    Removes the old MC and gets the following, waiting until what, when it booted transfer, adding to the scene
    function nextClip (): void {}
    thisLoader.load (new URLRequest (clips [index]));
    }

    AS of Tell the loaded file is a video clip and add it to the stage.
    function doneLoading(e:Event):void {}
    stage.removeChild (thisMC);
    thisMC = MovieClip (thisLoader.content);
    thisLoader.unload ();
    stage.addChild (thisMC);
    thisMC.play ();
    }


    'Next button' just calls a function that indicates the file name following (mod the number of files in the list)

    bttn1_mc.addEventListener (MouseEvent.CLICK, playNext);

    function playNext(e:MouseEvent):void {}
    nextClip();
    index = (index + 1)%(clips.length);
    }

    stage.addChild (bttn1_mc);
    bttn1_mc. Visible = true;

    You are welcome.

    Please mark this thread as answered.

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

Maybe you are looking for