AS3 access a SWF loaded by name

Hi all

In AS3, when a swf is loaded through the Loader class, how can I access the swf file loaded by name? Here is my code:

Stop();
var loader: Loader = new Loader();
var whichMovie:String = "main.swf";
addChild (loader);

function wakeLoadBar (): void {}
loadBar.gotoAndPlay ("is");
}

function loadTheMovie(theMovie:String):void {}
trace ("LOADTHEMOVIE");
loader.contentLoaderInfo.addEventListener (Event.OPEN, onLoaderOpen);
loader.contentLoaderInfo.addEventListener (ProgressEvent.PROGRESS, onLoaderProgress);
loader.contentLoaderInfo.addEventListener (Event.COMPLETE, onLoaderComplete);

Loader.Load (new URLRequest (theMovie));
}

function onLoaderOpen(event:Event):void {}
trace ('Open');
}

function onLoaderProgress(event:ProgressEvent):void {}
var p: Number = Math.floor (event.bytesLoaded/event.bytesTotal * 100) + 10;
loadBar.gotoAndStop (percent);
trace ('Progress' + %);
}

function onLoaderComplete(event:ProgressEvent):void {}
trace ("course").
}

wakeLoadBar();

function loadTheMovie is called after the "fadesIn" magazine, and the film begins to load.

Let's say that after loading film, I want to change its x and y, how can I do to make it?

laodedMovieName.x = 50;
laodedMovieName.y = 150;

use the charger.

Tags: Adobe Animate

Similar Questions

  • Start getting error - 'load - User\Name\Appdata\Roaming\iasnapw.dll - access denied error.

    From the start of my PC (with windows Vista), I always get a message: "load - User\Name\Appdata\Roaming\iasnapw.dll - access denied error" in any case I can still use my PC normally. What does this message and how to resolve this error.

    Thank you
    A. Wahyan

    Hello

    Google who provides virtually no information that suggests it might be the malicious program or a start remains for her entry search

    Download update and scan with the free version of malwarebytes anti-malware

    http://www.Malwarebytes.org/MBAM.php

    You can also download and run rkill to stop the process of problem before you download and scan with malwarebytes

    http://www.bleepingcomputer.com/download/anti-virus/rkill

    If it does not remove the problem and or work correctly in normal mode do work above in safe mode with networking

    Windows Vista

    Using the F8 method:

    1. Restart your computer.
    2. When the computer starts, you will see your computer hardware are listed. When you see this information begins to tap theF8 key repeatedly until you are presented with theBoot Options Advanced Windows Vista.
    3. Select the Safe Mode with networking with the arrow keys.
    4. Then press enter on your keyboard to start mode without failure of Vista.
    5. To start Windows, you'll be a typical logon screen. Connect to your computer and Vista goes into safe mode.
    6. Do whatever tasks you need and when you are done, reboot to return to normal mode.

    If the error persists after scanning use this program to out startup

    This utility, Autoruns for Windows, which has a knowledge of auto-starting locations of any startup monitor, shows you what programs configured to run at system startup or login and that the entries in the order of processing windows. These programs include those in your startup folder, Run, RunOnce, and other registry keys. You can configure Autoruns to show other locations, including Explorer shell, toolbar extensions, helper objects to the browser, Winlogon notifications, auto and many start-up services even more.

    http://TechNet.Microsoft.com/en-us/sysinternals/bb963902

  • Access to a loaded swf file

    I use this code to put in an another SWF into a movieClip called 'movieLoader ':

    var myLoader:Loader = new Loader();

    movieLoader.addChild (myLoader);

    var urlMovie:URLRequest = new URLRequest ("movie1.swf");

    myLoader.load (urlMovie);

    The movie loads fine, but how do I access it?

    I tried:

    trace (movieLoader.totalFrames);

    and he gave me a '1 '.  I know that the movieclip has more than 1 frame.

    What should I do to access the swf called 'movie1.swf', I just brought into this movieClip?

    After that is finished loading:

    trace (MovieClip (myLoader.Content) .totalFrames);

  • Has no type constraint-access variables of loaded swf

    Hey,.

    I have a problem accessing a variable loaded from another swf. In fact, the variable is a class singeltone, which must be initialized. It has the structure presented in the last part of the message.

    The project has the following structure:
    -main.swf - this all the other swf files and holds their load.
    -assets.swf - contains common elements and initializes the SingleTone class
    -interface.swf - contains some elements of the interface and must use the SingleTone class
    -all SWFs three have access to a common class structure, where the SingleTone class is defined.

    The problem I have now, accesses the SingleTone class in the interface.swf file. If I try to send the SingleTone.singleTone.property of the class parameter I get "type coercion failed: cannot convert ClassName @..» to ClassName. If I try to access the SingleTone class directly in the interface.swf file, I get "cannot access a property or an a null object reference...". ». The two errors I have seem logical:
    -If I send a parameter, I send the reference to this object, but the interface.swf file does not have access to the field of assets.swf.
    -If I try to access the SingleTone class directly in the interface.swf file, I get error null because the class is not initialized on the interface.swf domain.

    Are there close to work? I know that a simple solution may be to initialize the variable in the area of the interface.swf, but what if there is a variable that can be instantiated in the assets.swf? I can access this variable to another swf, or if I can change the ApplicationDomain?

    I found the problem. In the main.swf file, when I loaded the other 2 files, I didn't specify the LoaderContext. So now, I changed the context loader so that all files will be responsible for their class definitions in the same field. Here is a small example from senocular and the link.

  • TypeError: Error #1009 (SWF loaded)

    I'm pulling my hair out on this one!

    I'm just starting a website (website full-Flash) using CS3 and AS3. I'm pretty much used to the new changes in AS3. I built a rough structure to make sure that the way I wanted to create the site would work (external swf loading, etc.). The tests worked.

    Now, I'm going to do real things, and I get this error as soon as an external SWF to load in:

    ------------------------------------------------------------------------------------------ -----------------------------------------
    TypeError: Error #1009: cannot access a property or method of a null object reference.
    at test_fla::MainTimeline/test_fla::frame2()
    ------------------------------------------------------------------------------------------ -----------------------------------------

    I tried this shrinkage, impossible to find the exact culprit (had to remove every shred of ActionScript, before starting to work again). So, I started to rebuild this film entirely - allowed out of the library and deleted all the layers. Did not work. Impossible to add a stop(); action in Frame 1.

    Then I started completely expenses File > New, rebuilt again. I tested after every single change. I finally built it up to the point where I first tested the original, and it worked. Then added some things more re-tested and I get the error again. Ahh, so I removed EXACTLY what I had just added. Re-tested. SAME ERROR - now it won't go away little matter what I delete!

    Crazier still is that I can always load in my other test SWF files and they have stock in them and they are set up exactly the same way - but they work...

    The entire site is new, so each SWF is CS3/AS3. I'm even not doing something crazy, so I'm pretty frustrated trying to build an AS3 all the site and I even do basic stuff...

    I can download/email the FLA files in question, if someone has the time to watch...

    Thank you
    Brandon

    It sounds ridiculous, but I think it had to do with the file names...

    I think that Flash CS3 has some problem with multiple file names using a hyphen, and start with the same word... I changed this:

    -test - container.swf
    -test - home.swf

    to do this:

    -test - container.swf
    -home.swf

    And rebuilt the home.swf from zero (new). And it seems to work now.

    Here, loads of test - container.swf the home.swf inside himself, I think he cannot know how to distinguish between the two because of the initial error in screaming "test_fla" rather than the name 'test-container_fla' or 'test-home_fla.

    Ugh.

  • Best way to target a swf loader?

    In AS2, I created tons of projects where I've used _level0 as my main menu and to other sovereign wealth funds (for example, the tutorial chapters) incoming and outgoing _level1. My SWFs into _level1 acceding variable such as dates, username and those resident in _level0. I recreate it in AS3 using the class loader which works fine until I try to access the variables in my main swf. For example, menu.swf has a button that loads chapter_1.swf. This chapter_1.swf must Access a variable called userName string in menu.swf and display it in a text field. In AS2, I would simply write user_txt.text = _level0.userName. How do I do that in AS3? I know it's probably very easy, but I have not been able to target the menu.swf. I searched high and low for this answer, but I shouldn't be looking properly.

    I thank in advance for any help, you may be able to provide.

    Rob,

    You were very close to the solution in your first answer. I added an extra parent to your code and it worked. I think that's what kglad tried to tell me. The single parent was pointing the charger itself against the main timeline. So the correct code is:

    . UserName MovieClip (parent.parent)

    Thanks to each of you for your help.

  • Flash as2 cross subject to access the SWF from another server domain

    I have question cross-domain, how do I access the .swf from another swf file without using System.Security.allowDomain() in the swf file, which we are called.

    I use 2 domains and I have 2 files swf is a.com (a.swf) and another is of bcom (b.swf) I want to access the file the a.swf b.swf frames, if I use the system.Security.allowDomain() in b.swf file I can access executives. But without using this way I can access the file from another domain.

    Because I have a risk to change the file b.swf so I vant to go without changing the file b.swf is any other wey to access frames of the file the file a.swf b.swf. Please someone help me solve this problem.

    use a local executable (such as php) to load the b.swf and send it back to a.swf.  for example:

    loadSWF.php:

    <>

    $fh = fopen ("www.b.com/b.swf", "r");

    Header ("Content-type: application/x-shockwave-flash");

    fpassthru ($FH);

    ?>

    a.fla:

    var target_mc:MovieClip=this.createEmptyMovieClip("target_mc",this.getNextHighestDepth());

    target_mc.loadMovie ("loadSWF.php");

  • How to control the video swf loaded in the loading component?

    I have an external swf file loaded into the loading component. The external swf loaded into the component loading stops at departure. I want to play by a button outside the loading component that is located in the main swf movie. CAN SOMEONE HELP ME CONTROL THE VIDEO SWF LOADED INTO THE COMPONENT OF LOADING EXTERNAL?

    You can target the SWF via the content property of the UILoader.  If the name of the instance the UILoader is ldr...

    MovieClip (ldr.content) .play ();

  • Swf loader help

    Hello all, I use Flash CS4 with AS3.


    I have a problem with the preloader site. When I simulate the load it is 'invisible' for awhile and then appear from loading of ~ 24-27% or perhaps ~ 55%
    To resolve this problem some people suggested to create a loader.swf (where you want to preload) and the site.swf: when the loader.swf have loaded the site.swf then it appear.


    Well, I tried this with the following code:

    var file:Loader=new Loader();
    var: path string.
    load.bar.scaleX = 0;

    run the preLoader (event: Event): void {}
    If (file.contentLoaderInfo.bytesTotal! = 0)
    {
    load.bar.scaleX = (file.contentLoaderInfo.bytesLoaded / file.contentLoaderInfo.bytesTotal);
    Load.txt_perc. Text = String (Math.round ((file.contentLoaderInfo.bytesLoaded/file.contentLoad erInfo.bytesTotal)*100))+"%";))
    }
    trace (file.contentLoaderInfo.bytesLoaded);
    }

    function stopLoader (event: Event): void {}
    trace ("Downloaded");
    file.removeEventListener (Event.ENTER_FRAME, preLoader);
    load.bar.scaleX = 0;
    Load.txt_perc. Text ="";
    }

    file.contentLoaderInfo.addEventListener (Event.COMPLETE, stopLoader);

    function loadMovie (): void {}
    load.bar.scaleX = 0;
    var swf:URLRequest = new URLRequest (path);
    leader. Load (SWF);
    file.addEventListener (Event.ENTER_FRAME, preLoader);
    stage.addChild (file);
    }

    function path1(e:Event):void {}
    path = "example.swf";
    loadMovie();
    }

    stage.addEventListener (Event.ENTER_FRAME, path1);


    But he returns this error:

    #2044 error: Unhandled IOErrorEvent:. Text = #2036 Error: incomplete loading.


    Someone told me that this error is due to the impossibility to find the URL of the swf file, but this is false since the swf file is finished.

    If I look at the load simulation I see multiple copies of the swf file are "loaded", but nobody is 100%.

    However, I said "responsible" because if I put a trace (file.contentLoaderInfo.bytesLoaded); I see a 0 permanent.


    Please help me I'm going crazy!

    where did,

    removeChild (file);

    come from?   which removes your swf loaded from the display list.  remove this line of code.

  • (MX04) Pause a swf loaded with sound objects

    Hello

    I'm working on a presentation PowerPoint-esque where a user observes and listens to a swf loaded in the main sequence, click the button following (who unload the SWF, advances to the next section and load the next swf file), and the following watches. Make lather, rinse, repeat. Some articles are quite long, and I want to give the user the opportunity to take a break and play by click button.

    I know how to stop and start the MC container, but this does not prevent the sound object (and embedded CSM). I know how to make a break and start a sound object using the name of the instance of the object. Is there a way to pause the main story and keep the general enough so that any object sound stops when the user clicks on?

    Any help is most appreciated! MX04 and AS2.0.

    Thank you!

    you will need to list them all, or scroll through all the likely suspects with a loop (obj in mc).

  • SWF swf communication - swf loaded swf loading

    Hello
    I read the article by kglad SWF SWF communication when two SWF files uses actionscript 3.0 gratefully, but, probably because of my stubbornness, I have swf loaded at loading swf communication problems to work for me.

    Loading of swf (swf1.swf) as loaded swf (swf2.swf) by casting to a MovieClip loader.content worked well for me.

    I want the swf to call a function on the timeline of the swf file loading.  (Aside, I'm doubting it's possible, but I'm really very uneducated on this topic)

    I copied the article code in swf2.fla as below;

    Create a variable to refer to the main scenario for swf1

    var swf1Main_mc:MovieClip; This assumes that swf1 is a movieclip.

    Create your listener to ensure that loaded swf has been added to the display list and can get a

    the reference to the main timeline (which is always the main timeline of the SWF loading).

    this.addEventListener (Event.ADDED_TO_STAGE, initF);

    function initF(e:Event):void {}

    swf1Main_mc = MovieClip (this.root);

    }

    and add a simple button with an event listener for mouse to invoke a function (in swf2) for example

    function btnClicked(e:Event)

    {

    swf1Main_mc.showME ();

    }

    where showME() is a function in swf1.  for example

    function showME()

    {

    trace ("swf1 called swf2 showME");

    }

    All I get is a runtime error "TypeError: Error #1006: showME is not a function."  to swf2_fla::MainTimeline/btnClicked().

    I took out what little hair remains try different variations in the code then, in desperation, please someone can spot what I'm doing wrong or point me in the right direction?

    Thanks for your time,
    Bob

    A loaded swf file should not try to control its parent.  The child must only be send an event to the parent to take action.  In this way, the child is completely independent of the parent as well as to be able to publish on his own.  To load completion than the parent must assign an event listener to the child for this event, and the event handler function.

    Example:

    Add something to raise the event in the child:

    dispatchEvent (new Event ("eventTriggered")); (if problem dispatchEvent, see: http://www.kirupa.com/forum/showthread.php?p=1899603#post1899603)

    In your SWF to loading/parent, listen for the complete event on the Loader.contentLoaderInfo.  In the complete event handler, add a listener for the event on the loaded swf file.

    triggered when external swf loading event handler
    function loaderCompleteHandler(event:Event) {}
    MovieClip (event.currentTarget.content) .addEventListener ("eventTriggered", eventHandler);
    }

    function eventHandler(event:Event):void {}
    trace ("event sent in loaded swf");
    }

  • How to effectively remove a SWF loaded from the scene?

    I can't understand a correct coding to remove a SWF loded in the scene.

    Here is my set upwards.

    I have a layout that is segmented in section labeled. In the section titled 'products', I have a scheme consisting of images of products acting as buttons that bring a user in another section labeled "prdctsPopUps."

    In the "prdctsPopUps" section, I placed an instance of LoaderMax placed in a container of mc. Place LoaderMax in a container of mc automatically resolved a problem of clearing loaded SWFs from the stadium when I go back to the section "products".

    I specified the variable in the "products" section with the following set up:

    var sourceVar_ProductsPopUps:String;

    function onClickSumix1PopUp(event:MouseEvent):void {}

    sourceVar_ProductsPopUps = "prdcts_popups/sumix1 - popup_tl.swf ';

    gotoAndPlay ("prdctsPopUps");

    }

    So each button has its own "... swf ' URL and they all open very well and I can go back to the topic 'produced' without any problem.

    However inside the swf (that charge by LoaderMax which is placed in a mc) there are other buttons that lead a user to the section labeled "xyz". That works as well. It opens as he's supposed to be and without any previously loaded "... swf ' on the stage.

    In the section labeled "xyz", there is a limited set of buttons with the heading 'products' that must raise a user to the same game in the labeled 'prdctsPopUps' section and open a correspondent "... swf»

    However only the last opened "... swf" will appear in this section. Actually the only one that has been opened at the origin of the "prdctsPopUps" section, not who was supposed to be opened from the section "xyz".

    I do not understand why it would work a labeled section and not the other. I can't know which section what function/code should be placed.

    Here is the set up through a button in the section "xyz" supposed to bring a user to the same section of "prdctsPopUps" but to load another '... swf»

    var sourceVar_ProductsPopUps_fromXYZ:String;

    function onClick_floralytePopUp_fromXYZ(event:MouseEvent): void {}

    sourceVar_ProductsPopUps_fromXYZ = "prdcts_popups/floralyte - popup_tl.swf";

    gotoAndPlay ("prdctsPopUps");

    }

    Here's the code in place for the LoaderMax of the section "prdctsPopUps":

    var loaderProductPopUps:SWFLoader = new SWFLoader (sourceVar_ProductsPopUps,

    {

    estimatedBytes:5000,

    container: holderMovieClip,.

    onProgress:progressHandler,

    onComplete:completeHandler,

    centerRegistration:true,

    Alpha: 1,

    ScaleMode (ScaleMode): 'none',

    Width: 540,

    height: 730,.

    harvest: true,

    autoPlay:false

    });

    function progressHandler(event:LoaderEvent):void {}

    progressBarPopUp_mc.gradientbarPopUp_mc.scaleX = loaderProductPopUps.progress;

    }

    function completeHandler(event:LoaderEvent):void {}

    var loadedImage:ContentDisplay = event.target.content;

    TweenMax.to (progressBarPopUp_mc, 1.5, {alpha: 0, scaleX:0.25, scaleY: 0.25});

    }

    loaderProductPopUps.load ();

    Is there something that must be imported, or specific function must be specified in a specific titled section?

    in fact, I think that you will need to use something like:

    var loaderProductPopUps:SWFLoader;

    If ((loaderProductPopUps) {})

    {if (loaderProductPopUps.Content))}

    loaderProductPopUps.unload ();

    }

    }

    loaderProductPopUps = new SWFLoader (sourceVar_ProductsPopUps, //the value of sourceVar_ProductsPopUps allows to load several SWF files from the page produced.

    {

    estimatedBytes:5000,

    container: holderMov ieClip, / / convinient and easy to manage cases of placing the LoaderMax one mc empty (holderMovieClip)

    If this is not the case, will work as well. Then the container line: holderMovieClip, must be replaced by container: cela,.

    can be any size, cannot be resized as it distorts the content

    Manager onProgress:progress,

    onComplete: complete the Manager.

    centerRegistration: true,

    x:-260, y:-320, //no need for that is if used: centerRegistration:true,.

    Alpha: 1,

    ScaleMode (ScaleMode): 'none',

    scaleX:0, scaleY: 0,

    vAlign: "high."

    Width: 540,

    height: 730, / / scale proportionately but I need to cut the edges

    harvest: true,

    autoPlay:false

    });

    function progressHandler(event:LoaderEvent):void {}

    progressBarPopUp_mc.gradientbarPopUp_mc.scaleX = loaderProductPopUps.progress;

    }

    function completeHandler(event:LoaderEvent):void {}

    var loadedImage:ContentDisplay = event.target.content;

    TweenMax.to (loadedImage, 1.5, {alpha: 1, scaleX:1, scaleY: 1}); only need this line if the corresponding values are changed in Builder SWF loader

    TweenMax.to (progressBarPopUp_mc, 1.5, {alpha: 0, scaleX:0.25, scaleY: 0.25});

    }

    loaderProductPopUps.load ();

  • rinsing of the SWF loaded phase target mc?

    Hi, I'm using buttons to send the playhead to executives in which sovereign wealth funds are then loaded into an empty movieclip called "stage_target_mc"... .how I can then flush out the previously loaded swf then only a newly loaded swf displayed in "stage_target_mc"?  For example, after you click on the button 'about' swf 'about' load... then the "concepts" click the "concepts" swf loads - but the previously 'about' loaded swf plays again... I wish I could rinse the swf 'about' so only "concepts" are display, in this example.  Thank you!

    code associated with buttons that are used to send the playhead to frame "concepts" or "about":

    about_btn.addEventListener (MouseEvent.CLICK, displayAbout);

    function displayAbout(e:MouseEvent):void {}

    root.gotoAndStop ("about");

    }

    concepts_btn.addEventListener (MouseEvent.CLICK, displayConcepts);

    function displayConcepts(e:MouseEvent):void {}

    root.gotoAndStop ("concepts");

    }

    code on frame called "concepts":

    stage_target_loader. Load (new URLRequest("swfs/stages/concepts.swf"));

    MovieClip (root).stage_target_mc.addChild (stage_target_loader);

    code on frame called 'a way':

    stage_target_loader. Load (new URLRequest("swfs/stages/about.swf"));

    MovieClip (root).stage_target_mc.addChild (stage_target_loader);

    Before loading, try to use the method of the Loader class unloadAndStop() If you are using a version of Flash newr

  • How can I create buttons of switch trigger MC in swf loaded

    Hello

    I am a newbie in ActionScript 3 and I am currently working on a project that has a (zoom) swf that zoom/pan a swf loaded a map (carte_web.swf). Everything was going well until I got more requests.  There are now two cards, same background, one with images and one with only one road. I try to add code to two buttons on a toolbar that is generated by the zoom.swf, to switch between the two cards, without losing its zoom/pan my cards are the two Flash-oriented object programming.  I spent 27 hours, trying to find a way, and I'm definitely at the end of my mind!

    I have a suggestion "to charge both your SWF in a sprite separately.» Then switching between sovereign wealth funds by removing and adding them to their parent sprite. The parent sprite is what you zoom. "I've tried everything!

    Any suggestions?

    If you want to keep the current state of each 'card', you will need to load each of these sovereign wealth funds in different sprites. In this way, you can just addChild and removeChild and save the State without having to reload the SWF file. Another way, you could actually do, would be to just reload in a sprite, and before you unload the SWF file, save all data of zoom/pan in an array or variable or something of that sort and just restore data to the card when it is reloaded. Don't know if I make sense here, but without details of your exact problem, it is difficult to say.

  • How to get the content incorporate the swf file in Swf Loader on the run time

    How to get the content incorporate the swf file in Swf Loader on the run time

    [Bindable]

    [Embed(source="assets/index.swf")]

    private var SWFSRC: Class;

    < mx:SWFLoader id = "_swfloader" source = "{SWFSRC}" / >

    It might be Loader (DisplayObjectContainer (_swfLoader.content) .getChildAt (0)) content

Maybe you are looking for