Set index of an external swf in a mc

Hello,
i have a trouble with this:
a main movie clip (photo_group) which call an external movieclip from xml which call another movieclip which load a video... but the video is placed at the bottom of my main stage and i would like to have it at the top of everything.
here's the code
main clip :
function loadClip():void
       var Clip_request:URLRequest = new URLRequest( folderswf + photo_list[swf_no].swf);
       var Clip_loader:Loader = new Loader();
       Clip_loader.load(Clip_request);
       Clip_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, on_Clip_loaded);
       swf_no++
function on_Clip_loaded(e:Event):void
       Clip_mc = MovieClip(e.target.content);
       photo_group.addChild(Clip_mc);
       Clip_mc.x = (photo_group.numChildren-13) * max_pic_width;
       Clip_mc.y = 250;
       if( swf_no < total_items )
             loadClip();
       else
              move_photo_group();
Calling VideoClip :
bouton.addEventListener(MouseEvent.CLICK, loadVideo)
function loadVideo(e:MouseEvent):void
      var Video_request:URLRequest = new URLRequest("loadvideo.swf");
      var Video_loader:Loader = new Loader();
      Video_loader.load(Video_request);
      Video_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, on_Video_loaded);
function on_Video_loaded(e:Event):void
      var Video_mc:MovieClip = new MovieClip();
      Video_mc = MovieClip(e.target.content);
      addChild(Video_mc);
      Video_mc.x = 100;
      Video_mc.y = 100;
Video Clip :
var video_container:MovieClip = new MovieClip();
addChild(video_container);
var video:Video = new Video();
video_container.addChild(video);
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.client = {};
ns.client.onMetaData = ns_onMetaData;
ns.client.onCuePoint = ns_onCuePoint;
ns.play("_wje/_vff/_tuj/toto.flv");
video.attachNetStream(ns);
function ns_onMetaData(item:Object):void
    video.width = 360;
    video.height = 248;
    video.x = 200;
    video.y = 200;
i need help please

you are right the blue thinguy is in fact a bouton in my swf.
i'm still kindof lost tho, i don't quite understand what you means by "move the loader" sorry i'm still a noob at flash and speaking english doesnt help.
here's the full source files with everything if you have time to take a look, it might be easier than pasting chunk of code
source files

Similar Messages

  • Loading External SWF and setting variables

    Hello Everyone.
    I'm sure you are all a where of the FlashVars attribute for
    Flash embeds which holds variables for SWF's when they are
    rendered. I'm attempting to load an External SWF dynamically
    from within my own SWF and need to provide it with the values
    normally stored in the FlashVars. For the example below I
    wait until the External SWF is completely loaded using the
    onLoadInit event from moviecliploader and then i attempt to
    set the required variables that the loaded SWF needs. This works
    great in test and debug mode (ie. Test Movie and Debug Movie
    from the Control menu), but when i publish my FLA to SWF and run
    the SWF the variables will NOT get set in the loaded External SWF.
    From my readings ive people have mentioned that the player is only
    able to access Methods of an External SWF. If this is the case then
    how do they expect people to set the FlashVars of dynamically
    loaded SWFs? I investigated the loadVariables procedure as well and
    had the same results in test mode and was wasn't reliable because
    of timing issues.
    The sample source is below... if anyone has any ideas or has
    come across this issue before, I would really appreciate some
    insight.
    Thank you in advance for your time.
    var loader_mc:MovieClipLoader = new MovieClipLoader();
    var mclListener:Object = new Object();
    loader_mc.addListener(mclListener);
    mclListener.onLoadProgress = function(target_mc:MovieClip,
    numBytesLoaded:Number, numBytesTotal:Number) {
    // DO NOTHING
    mclListener.onLoadComplete = function(target_mc:MovieClip) {
    // DO NOTHING
    mclListener.onLoadInit = function(target_mc:MovieClip) {
    // WORKS IN TEST MODE NOT IN PUBLISH/SWF MODE
    target_mc._root.param1 = "value1";
    // WORKS IN TEST MODE NOT IN PUBLISH/SWF MODE
    _level0.container_mc.param1 = "value1";
    this.createEmptyMovieClip("container_mc",
    this.getNextHighestDepth());
    container_mc._lockroot = true;
    loader_mc.loadClip("somecoolflash.swf", container_mc);

    I've tried that as well and it behaves the same as onLoadInit
    ... Works when i test but doesnt when i publish to a swf. I think
    this is security related and the flash player just cant write to a
    loaded swf and set variables.

  • What is or isn't possible on iOS?  (Not having Loader, loadBytes(), external swfs, etc)

    My basic question is:  "What are the classes which we should not use for iOS using the packager."
    I have been trying for a few days trying to get a simple Flash app to run on the iPad.  A very simple app (with sound!) with just 2 classes works fine (Performance is a whole other issue.  We will get to that).  But if I try anything else, all I get is a white/black screen on the iPad.  So it would be really nice to know what classes, functions, etc we CANNOT use for the Packager.
    I have fairly simple app (not as simple as 2 classes) which loads some art assets via URLRequest/Loader, puts them on the stage.  Fairly common standard practice in AS3.
    I've read about not able to load an external file using the Packager.  So to fix the situation of loading assets, I have looked into the [embed] tag, which seems to work.  I hope the blogger doesn't mind, but this page is an excellent source on what works and doesn't work with the [embed] tag in it's various flavors:  http://www.richardleggett.co.uk/blog/index.php/2010/03/08/flash_builder_and_flash_pro_asse t_workflows.  For example, AS3 in a swf is stripped out from an external swf using [embed].
    The best way to load an external swf file for iOS seems to be using [embed] with "application/octet-stream" and load the swf through ByteArray (Option #4 in the link above).  This works great on the PC.  HOWEVER, on iPad, it fails.  The [embed] tag works on the iPad with the other ways, so my guess is that loadBytes() does not work.  Is this true Adobe/Flash guys?  Can you confirm this?
    My initial question is "why is this not allowed on iOS?".  If it is because of the fact that it uses a Loader, can it be changed so it's not using a Loader to construct a MovieClip?  I have a ByteArray with the raw swf/MovieClip data.  Why can't I construct a MovieClip from it without going through Loader?
    This loadBytes() failure seems to be the only thing preventing me from using the normal pipeline of Flash development in loading external assets.  If there are other ways people have found, please share!
    Now on to performance.  Adobe, can you post some examples/samples of code which runs at decent performance?  Like a "tech demo" of what is possible using the Packager running on iPad/iPhone.  That would be extremely helpful for everyone.  I have done a lot of the optimizing suggestions on various sites and pages ( and by Adobe http://www.adobe.com/devnet/flash/articles/optimize_content_ios.html), but I am not seeing the 30 fps performance that is MORE than possible on iPhone/iPad.  Displaying and moving around Bitmaps (I don't use any vector graphics) should be blazing fast.  Quake runs on iPad without any problems and that code is 10 years old.  Moore's law dictates that drawing Bitmaps using CPU should be faster than a 3D engine written 10 years ago...  I am trying out the new iOS 4.2 which is supposed to be "significantly" better, but I am still stuck on loadBytes().
    So at this point, I am blocked on loadBytes() and my performance for a simple app which draws a few Bitmaps and MovieClips is terrible.  I am hopeful some people out there have figured out some solution (there are lots of clever people out there) and I will stumble on to something.  But being forced to go native Objective-C seems to be my only option at this point.
    In summary, here are the questions I would like to ask the Adobe/Flash group for some more help/information/advise:
    - Why is Loader not allowed on iOS?  Is it a technical limitation of the hardware/os/Flash?  Will it never be supported?  What is the future of this class on iOS?
    - Why is loadBytes() not allowed on iOS?  I have the raw embedded data in memory.  I don't need to make a remote call so security should not be an issue.  Can I create a MovieClip without using Loader?
    - Why is AS3 stripped from the timeline when a Symbol is retrieved using [embed]?  Maybe this is the same reason loadBytes() fails, but if I could use [embed] and get a copy of the Symbol, that is what I need.  (There are issues with the mx.core.MovieClipLoaderAsset/Asset, but it is better than being blocked by loadBytes())
    - What are some apps you guys have written that we can use to compare PC vs iOS?  Again, a "tech demo" or sample code of what you as experts in Packager for iOS have done which runs at decent framerate (30+fps) would be of tremendous help.  If the Adobe/Flash group hasn't gotten the current Packager for iOS to handle more than 50+ 2D Bitmaps on screen running at 30+fps, that would be good to know.  Please let us know what the experts and owners of your software are capable of getting the most throughput using the Packager.  I'd hate to sound a bit fed up/angry, but I think you are wasting a lot of people's time and energy with a piece of software that, to me, seems like it was a bit early to release.  Flash can do some great things.  If it can do it on iOS, even better.  But PROVE it to us that it's possible, before having your customers run into barriers imposed on us by trial and error.
    Thanks.

    I have hardly ever seen a post here from someone at Adobe, so you may need to be patient.
    Read this article, and get its associated demo files, to see some good performing tech demos:
    http://www.adobe.com/devnet/flash/articles/optimize_content_ios.html
    Back to your main point, loaders are working, what isn't working for you is accessing of things in the library of a successfully loaded swf, that have been set to Export for ActionScript. That means that the swf you have loaded has an ActionScript Class, to represent the library symbol. iOS Flash apps are native ARM code, and don't include the virtual machines that a browser plugin has, and so it's not able to interpret ActionScript. That may be why it would fail.
    Now, I can think of at least a couple of reasons why you might want to have external swfs with elements that you want to reuse in the main swf. One would be if you're intending to make a lot of them, like say if you wanted to have an Asteroids game and the ability to use artwork from a set of different swfs. Another reason might be if you want to skin your interface, by taking specific elements from the loaded swf and using them in the main swf. That way you could have artists preparing those swfs for you, and you just include them in your package, and load the one you want.
    There is a way to do either of those things. The second one can be done by having the item as a named symbol on the stage of the loaded swf. With a to-be-loaded swf named "inner.swf", that has a movieclip on its stage named "mc1", this script in the main swf would load that external swf and use its symbol on the main swf's stage, without having to make the inner swf's symbol use ActionScript:
    var req:URLRequest = new URLRequest("inner.swf");
    var ldr:Loader = new Loader();
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
    ldr.load(req);
    function loaded(e:Event) {
    var mc:MovieClip = e.target.content as MovieClip;
    var innermc:* = mc.mc1;
    innermc.x = 50;
    innermc.y = 50;
    addChild(innermc);
    For the other case, you can take the item off the stage of the loaded swf and draw it into a bitmapdata, and then make as many bitmaps from that as you like. Here's the above example, only it adds the original movieclip to the main swf stage, and also creates a bitmap that looks the same:
    var req:URLRequest = new URLRequest("inner.swf");
    var ldr:Loader = new Loader();
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
    ldr.load(req);
    function loaded(e:Event) {
    var mc:MovieClip = e.target.content as MovieClip;
    var innermc:* = mc.mc1;
    innermc.x = 50;
    innermc.y = 50;
    addChild(innermc);
    var bmd:BitmapData = new BitmapData(innermc.width,innermc.height);
    bmd.draw(innermc);
    var bm:Bitmap = new Bitmap(bmd);
    bm.x = 150;
    bm.y = 150;
    addChild(bm);
    So, the thing to learn is that a native ARM code application does not have an ActionScript interpreter in it, and if you need to do something that normally requires interpreting ActionScript, find another way to do it.

  • Unloading external swf

    Hello everyone,
    I'm kind of new to AS3
    I created a flash file and i have several buttons on the main
    stage.
    I have given the buttons instance names and whenever a button
    is clicked an external swf is loaded on the main stage.
    The problem which occurred is that ehenever i click on the
    same button again i can see a glimpse of the previous swf that was
    loaded meaning that i didnt get rid of the swf on the click of
    another button.
    What i want to achieve is to load the external swf and then
    when i click on another button i wish for it to unload.
    Here is the code.
    var externalSWF6:URLRequest = new URLRequest("dress6.swf");
    var myLoader6:Loader = new Loader();
    button6.addEventListener(MouseEvent.CLICK, onButtonClick6);
    myLoader6.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
    swfLoading6);
    myLoader6.contentLoaderInfo.addEventListener(Event.COMPLETE,
    swfComplete6);
    function onButtonClick6(event:MouseEvent):void
    myLoader6.load(externalSWF6);
    function swfComplete6(event:Event):void
    addChild(myLoader6);
    myLoader6.x = 0
    myLoader6.y = 0
    function swfLoading6(event:ProgressEvent):void
    var externalSWF7:URLRequest = new URLRequest("dress7.swf");
    var myLoader7:Loader = new Loader();
    button7.addEventListener(MouseEvent.CLICK, onButtonClick7);
    myLoader7.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
    swfLoading7);
    myLoader7.contentLoaderInfo.addEventListener(Event.COMPLETE,
    swfComplete7);
    function onButtonClick7(event:MouseEvent):void
    myLoader7.load(externalSWF7);
    function swfComplete7(event:Event):void
    addChild(myLoader7);
    myLoader.x = 0
    myLoader.y = 0
    myLoader7.addEventListener("UnloadMe", unloadFunction7); //
    <-- My line
    function unloadFunction7(event:Event):void {
    // event.target is the loader reference.. so cast it as
    Loader
    Loader(event.currentTarget).unload();
    function swfLoading7(event:ProgressEvent):void
    var externalSWF:URLRequest = new URLRequest("dress4.swf");
    var myLoader:Loader = new Loader();
    button4.addEventListener(MouseEvent.CLICK, onButtonClick);
    myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
    swfLoading);
    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    swfComplete);
    function onButtonClick(event:MouseEvent):void
    myLoader.load(externalSWF);
    function swfComplete(event:Event):void
    addChild(myLoader);
    myLoader.x = 0
    myLoader.y = 0
    function swfLoading(event:ProgressEvent):void
    var externalSWF8:URLRequest = new URLRequest("dress8.swf");
    var myLoader8:Loader = new Loader();
    button8.addEventListener(MouseEvent.CLICK, onButtonClick8);
    myLoader8.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
    swfLoading8);
    myLoader8.contentLoaderInfo.addEventListener(Event.COMPLETE,
    swfComplete8);
    function onButtonClick8(event:MouseEvent):void
    myLoader8.load(externalSWF8);
    function swfComplete8(event:Event):void
    addChild(myLoader8);
    myLoader.x = 0
    myLoader.y = 0
    myLoader8.addEventListener("UnloadMe", unloadFunction8); //
    <-- My line
    function unloadFunction8(event:Event):void {
    // event.target is the loader reference.. so cast it as
    Loader
    Loader(event.currentTarget).unload();
    function swfLoading8(event:ProgressEvent):void
    var externalSWF9:URLRequest = new URLRequest("dress9.swf");
    var myLoader9:Loader = new Loader();
    button9.addEventListener(MouseEvent.CLICK, onButtonClick9);
    myLoader9.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
    swfLoading9);
    myLoader9.contentLoaderInfo.addEventListener(Event.COMPLETE,
    swfComplete9);
    function onButtonClick9(event:MouseEvent):void
    myLoader9.load(externalSWF9);
    function swfComplete9(event:Event):void
    addChild(myLoader9);
    myLoader.x = 0
    myLoader.y = 0
    function swfLoading9(event:ProgressEvent):void
    //you can do something here while the swf is loading... }
    button4.buttonMode = true;
    button6.buttonMode = true;
    button7.buttonMode = true;
    button8.buttonMode = true;
    button9.buttonMode = true;
    button4.addEventListener(MouseEvent.ROLL_OVER,buttonOver4);
    button4.addEventListener(MouseEvent.ROLL_OUT,buttonOut4);
    function buttonOver4(e:MouseEvent):void
    e.currentTarget.gotoAndPlay("over4");
    function buttonOut4(e:MouseEvent):void
    e.currentTarget.gotoAndPlay("out4");
    button6.addEventListener(MouseEvent.ROLL_OVER,buttonOver6);
    button6.addEventListener(MouseEvent.ROLL_OUT,buttonOut6);
    function buttonOver6(e:MouseEvent):void
    e.currentTarget.gotoAndPlay("over6");
    function buttonOut6(e:MouseEvent):void
    e.currentTarget.gotoAndPlay("out6");
    button7.addEventListener(MouseEvent.ROLL_OVER,buttonOver7);
    button7.addEventListener(MouseEvent.ROLL_OUT,buttonOut7);
    function buttonOver7(e:MouseEvent):void
    e.currentTarget.gotoAndPlay("over7");
    function buttonOut7(e:MouseEvent):void
    e.currentTarget.gotoAndPlay("out7");
    button8.addEventListener(MouseEvent.ROLL_OVER,buttonOver8);
    button8.addEventListener(MouseEvent.ROLL_OUT,buttonOut8);
    function buttonOver8(e:MouseEvent):void
    e.currentTarget.gotoAndPlay("over8");
    function buttonOut8(e:MouseEvent):void
    e.currentTarget.gotoAndPlay("out8");
    button9.addEventListener(MouseEvent.ROLL_OVER,buttonOver9);
    button9.addEventListener(MouseEvent.ROLL_OUT,buttonOut9);
    function buttonOver9(e:MouseEvent):void
    e.currentTarget.gotoAndPlay("over9");
    function buttonOut9(e:MouseEvent):void
    e.currentTarget.gotoAndPlay("out9");
    If anyone can be of assistance i would greatly appreciate
    it:)

    Your choices for removing objects are removeChild() and
    removeChildAt().
    So you need some way of tracking the objects that are added
    so that they can be removed. IF the buttons are the only things
    that add new content while the movie is playing, then the last
    thing added will have an index = numChildren-1,
    So if you want to remove the last movie before the new movie
    is added, then use removeChildAt(numChildren-1)
    Now, for the first time you use this, it will remove the last
    element on the stage, which you don't want, so you should probably
    have a variable that is set when any button is clicked and a
    conditional that checks it....
    var buttonClicked:Boolean = false; // set to true when a
    button is clicked
    in the handler:
    if(buttonClicked){
    removeChildAt(numChildren-1)
    buttonClicked = true;
    There are other ways of targeting in the event the movie was
    not the last thing added to the stage when another button gets
    clicked, such as assigning name to the movie or capturing which
    index it has when it is loaded.

  • How to control timeline sound of external SWF

    Hi All,
    Basic Intro:
    I am new in Action Script and trying to create a video tutorial framwork. In this I have lots of animated SWF files in all the files I have multiple scenes as those are 5min. to 10 min. each and all the files have the relevent background and nurration voice place directly on the TIMELINE frame by frame to match lip syncing animated chreactors.
    My file structure :
    Login.swf with login box is embedded into the Index.html
    After logged in it will load another SWF which is Control panel.swf
    3. Controlpanel.swf has the controls to control the loaded external swf files i.e.: Chapter menu, Play, pause, replay, volume-bar, next and previous buttons.
    By Default Controlpanel.swf will open chapter1.swf as soon as user logged in so no one need to open 1st file.
    Here user can navigate to other chapter swf file through Chapter menu or Next and Previous buttons.
    All files are loading and playing properly, here I am trying to control the animation and Sound both at a same time with Pause, Play and Replay through relevant buttons.
    Problem:
    By pressing “Pause button” animation stops but not the sound. Sound remains playing, and if I replay the swf by “Replay button” than animation restarts but sound also restarts that overlaps already playing audio.
    Question: So could anybody help me finding out how to:
    1. Pause the sound with animation by the same click of Pause button, and
    2. Stop the sound with animation by the same click of Stop button, and
    3. On replay it should stop playing the previously running audio and restart it with the animation like fresh loaded file, it should not sound overlapping.
    Constraints:
    Here I am using the sound file on the same time line of each individual swf file which I cannot add into any single movie clip because all the chapter swf file are having multiple scenes in it.
    For my problem I have already done a lot of browsing online in various forums and didn't find the solution. So here I am sharing the complete information regarding the project and wishing to get some good solution out here but if I missed any helpful information please ask me anytime and please help me to quickly find out the solution.
    Thanks a lot to all of you in advance to help me.

    create one global sound variable
    you can write when you are pressing pause button
    globalsoundvariable.setVolume(0)
    to play
    globalsoundvariable.setVolume(100)

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

  • External .swf runtime linkage .pngs AS3

    Flash can compress .png files like Photoshop can compress
    .jpg files better than any other tool hands down.
    I have 77 .png files that are 1.8 .megs on my c: drive after
    I imported them and setting the file compression under the "File
    > Publish Settings" to 75% for jpg and published the .swf with
    all the .png on the stage the file size is 350K that's about 20% of
    the original file size of the .pngs downloaded file by file with 77
    separate request.
    I can create linkage in the shared .swf and test the movie
    with code in the shared .swf to add the movieclip holders for each
    .png to the stage but when I load the shared .swf into the main
    .swf Flash acts like it can't create the classes based on the
    linkage I setup or that the MovieClip linkage doesn't exist.
    I tried a test to have the shared .swf with all the .pngs and
    linked movieclips to add the assets to it's own stage and it works
    fine but that means a lot of my code and logic is included in the
    shared .swf that the designers need to add .pngs to. It's
    unfortunate AS3 sucks but I'm just about done with the project if I
    knew what a battle AS3 was going to be I would have stayed with AS2
    my next projet will be AS2 no question non at all. Anyway I setup
    "class" linkage identifier for each .png with a movieclip holder
    for each image. The 20% of the size for the pngs and one request
    vs. 77 separate request makes it worth the extra effort of
    importing the images, creating a holder movieclip with linkage but
    the main .swf that loads the shared .swf with all the assets and
    linkage can't see or create the assets like the shared .swf can
    when I test it.
    We need to have the main .swf get a handle of the linked .png
    assets and place them in the main .swf to load the assets to
    different parts of the main .swf. It's cute that the shared .swf
    can add the linked assets to it's own stage but not too useful.
    Also the way we deploy we cannot roll out a new release/build to
    update the .pngs but we can upload a new .swf to the asset server
    so the .pngs need to be in a separate .swf. I can get the shared
    MovieClip to add the linked assets to it's own stage when testing
    and when loading my problem is the main .swf that loads the shared
    .swf cannot create instances of the classes that are exported for
    runtime sharing using linkage.
    If it is possible I would like to know how the heck you get a
    handle on a linked asset in an externally loaded .swf. Preferably
    without creating my own prototyped insane class consisting of mega
    libraries of external .as files. Just a way to reference MovieClips
    holding pngs that have linkage and are setup for runtime sharing.
    It really shouldn't be this hard it's a simple task in AS2. I'm not
    looking for a coding competition or some wild class to do the job I
    want a few lines of code to create an instance of a class then
    reference to the linkage/MovieClip holding the .png to addChild it
    into a target movieclip.

    I solved it I'm loading 77 embedded assets in an external
    .swf that compresses 77 .png images without loosing quality it
    works great.

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

  • Loading external swf  not complete

    Hi, I'm trying to load external swf (with more than one frame and actionscript 3 on every frame - I used there "timeline" coding) from my main swf.
    code for loading external swf into main swf:
    var loader01:Loader;
    function openGame1(evt:Event):void
    loader01 = new Loader();
    var requestSWF01:URLRequest = new URLRequest("game01.swf");
    loader01.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, processHandler);
    loader01.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
    loader01.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
    loader01.load(requestSWF01);
    addChild(loader01);
    function processHandler(evt:ProgressEvent):void
    var loaded:Number=evt.target.bytesLoaded;
    var total:Number=evt.target.bytesTotal;
    var stav:Number=loaded/total;
    loaded_txt.text=(Math.round(stav*100))+" %";
    function initHandler(evt:Event):void{
    loaded_txt.text="";
    function errorHandler(evt:IOErrorEvent):void
         trace ("Error: " + evt.text);
    I found out that this works only for loading swf, which has only one frame (and all actionscript on that frame)... It seems that if there are more frames, than it will not load complete swf (hmm maybe it is caused, because not all objects on frames are export in first frame). Preloading starts but after for example 20 % the event.INIT is fired and the external swf starts to play (and crashes..).
    You can see this here http://bvyborcik.xf.cz/  If you click on the blue building on the left with blinking text "Start hry" you will see what happens - preloading is not completed and after clicking on first floor btn, the swf crashes...
    Please is there a solution for this kind of problem?  Any help or pointing is welcome.
    regards Boris

    just curious, is the file you want to load the swf into set up exactly the same way with the same stage size, fps, and layers?

  • Loading an external SWF from an external SWF

    Hello,
    I'm somewhat caught between a rock and a hard spot on a flash
    site project. Here is the situation:
    I have created a parent movie (which loads all external SWFs
    inside of it) that has the menu navigation built into it. However,
    my client wants me to place some more links inside of the external
    SWFs that lead to other pages (external SWFs) of the site. Is this
    at all possible? I was hoping there is a way to tell a button in an
    external SWF to make the parent movie switch between external SWFs.
    Any and ALL help is very much appreciated. Thank you.
    Another question: does this involve using the _parent script?
    Elijah

    Hello,
    Thank you for replying. Here is exactly what I'm needing to
    do:
    We will call the parent file "index.swf". Inside "index.swf"
    I have a "holder" for external swf files to load into when I call
    on them from the main menu buttons on "index.swf". When a customer
    comes to the site, the "index.swf" file initially loads
    "welcome.swf". Inside of "welcome.swf", I have some images that I
    want to make into links to other external swf files.
    My problem is when someone clicks on one of those pictures I
    want the "index.swf" file to open up the corresponding external swf
    file in its "holder", where "welcome.swf" currently resides. Also,
    all of these swf files ("index.swf" included) have stand-alone FLA
    files, none are attached to one another. I have never worked with
    "levels" before, would that be necessary in this case? I have
    attached the code for the external swf loader.
    I hope that gives you a better idea of what I'm trying to
    accomplish.
    Thanks again.
    Elijah
    CODE:

  • The loaded external.swf don't appears on two client connected in VideoCommunication...

    Hi, everybody...
    I have to realize a videocommunication, whit Apache web server and FMS 3. This's ok...
    I have a button that load an external .swf but, when the 2 client are into communication, when I push the button, the external .swf starts only on the local client and not on the other client.
    Can someone help me?
    Thanks.
    Emiliano.

    Hi Csound1, thanks. The email host is 1and1.co.uk, however, i am going to fess up and make myself look like a plonker now -
    the email account in question was set up in Outlook as POP - stupid, stupid, stupid me, wasted an afternoon on this!  I have now changed the Outlook account to IMAP and Mail.app works perfectly - and looks much nicer than Outlook did.  Im in the middle of converting from Windows to a Mac, and still finding my way around the Mac
    The lesson learned, never assume - always double  check!  All my other email addresses with 1and1 are all imap, except this one, and it happened to be the first one I set up in the Mail.app. (bows head in disgrace!)
    Thank you anyway for attempting to help me!
    Cheers

  • Bring loaded external swf to the front

    Hi,
    I am now implementing to create a website using side scrolling platform game approach. Since the player/actor (character that moves according to keyborad events) should always be at the top layer, I am having difficulties to get my loaded swf on top of the player. I am currently using Flash cs6 (as3).
    Basically, in my main stage, there are 3 layers. 1 for actionscript, the scond one for player and lastly for background.
    Layer player contains player mc and background mc.
    Background mc contains visual and collisions layers.
    Anything that got to do with visual, i have to put it in visual layer.
    In visual layer i have backgroundcontainer mc
    So, as i put the button in the backgroundcontainer mc to call the external swf, the loaded external swf appears in the container.
    (I am using load/unload snippet code to call the external swf)
    I want the external swf to appear on top of the player.
    for (var fl_ChildIndex_2:int = 0;
            fl_ChildIndex_2 < this.numChildren;
            fl_ChildIndex_2++)
        this.getChildAt(fl_ChildIndex_2).addEventListener(MouseEvent.CLICK, fl_ClickToBringToFront_2);
    function fl_ClickToBringToFront_2(event:MouseEvent):void
        this.addChild(event.currentTarget as DisplayObject);
    Any help would greatly appreciated 

    If you want an object to move atop all others you can just use addChild(thatobject), where thatobject is the item you want to move atop anything else.  I don't know what object(s) your loop is attempting to act on, but it appears to be trying to change the index of all child objects rather than just one.

  • AS3 loading external swf files with buttons from inside a movieclip

    In my main .swf I have labels on the timeline, navs for those btns are on the first frame of the AS layer and each button sends the playhead to a different frame.
    On one frame called fr1 there is an mc called mc_1 that appears on stage when the playhead stops there. Inside mc_1 are a set of navigation buttons that need to call external .swfs.
    Do I add event listeners on the last frame of mc_1 for each button?
    how do I call the loaders for the swfs on the buttons since the swfs will load on the main timeline NOT the mc_1 timeline?
    So label on main timeline called fr1 will load external1 swf , on fr10 external 2.swf will load and so on.
    any help?

    The code for that button's event listener needs to be placed wherever it has direct access to the button.  Not necessarily on the same timeline, but in a place where both the button and the code are present at the same time.
    The code could be placed at the frame in the main timeline where the movieclip with the button(s) is, targeting the buttons via the movieclip (mc.button.addEvemtListener...) , unless the buttons are somewhere down the timeline of that movieclip.
    If they are down the timeline of that movieclip, then you would need to have the event listener also inside the movieclip, down its timeline where the buttons are finally settled in... being sure to assign instance names to the buttons at every keyframe.

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

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

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

  • Loaded external SWF gets blurry fonts/bitmaps

    Hi all
    When i load an external swf file it looses quality and
    renders blurry. But the swf itself (the external one) looks
    perfectly fine standalone. Now i ask myself, is this really a
    flashbug or what the heck is it?
    Because i wrote an elearning player wich references hundreds
    of this files, its not very funny to see the quality dropping. To
    get some meat for you, i created a small site, wich should make the
    problem much clearer:
    Click here and
    explore the strange bug
    If anybody has some useful information about it, i am more
    than glad to hear it!
    tks for all the fish and goodbye
    roger

    How was the swf generated? If you were using Camtasia Studio,
    there are
    issues with using Flash 8 player.
    Lon Hosford
    www.lonhosford.com
    Flash, Actionscript and Flash Media Server examples:
    http://flashexamples.hosfordusa.com
    May many happy bits flow your way!
    "StevenMcQueen" <[email protected]> wrote in
    message
    news:e5mu9e$dmd$[email protected]..
    Hi all
    When i load an external swf file it looses quality and
    renders blurry. But
    the
    swf itself (the external one) looks perfectly fine
    standalone. Now i ask
    myself, is this really a flashbug or what the heck is it?
    Because i wrote an elearning player wich refences hundert of
    this files,
    its
    not very funny to see the quality dropping. To get some meat
    for you, i
    created a small site, wich should make the problem much
    clearer:
    <a target=_blank class=ftalternatingbarlinklarge
    href="
    http://lux.to/tests/ppt2swf/index.html">Click
    here and explore the
    strange bug</a>
    If anybody has some useful information about it, i am more
    than glad to
    hear
    it!
    tks for all the fish and goodbye
    roger

Maybe you are looking for

  • Apple Ireland public relations rule Apple all the way

    Hey i recently had been having a lot of trouble lately trying to get my hinges fixed on my Macbook. I was told by the company doing the repairs that they were not covered under warranty. I know i did not do anything out of the ordinary to damage the

  • How to lock a table in a report program

    Hi all,      I have a requirement inwhich if i have selected one radio button  the table should locked .    and the i need to check wether the table is locked or not by checking the condition.if locked continue else i need to stop. can any one help m

  • Can't Upgrade to Parrot Pro because it's already purchased

    Hi there. I bought the pro version of Parrot Voice Recorder a while ago (last year maybe?) when I had my Z10. I've upgraded to a passport and all my apps installed fine (including iGrann Pro). However, Parrot is only the free version. I used the in-a

  • PS 7.0 on 10.5 intel mac

    Hi, I have switched from 10.4 on a G5 to 10.5 on an Intel mac and now get the following message when I try and open PS 7.0. "An unexpected and unrecoverable problem has occurred because of a program error. Photoshop will now exit." Is it possible to

  • Bizhub C360 crashes MS Office 2011

    Hi All, I have an issue where every mac in my office (all running some flavor of 10.7, most 10.7.5) crashes when trying to Layout & Finish print menu in MS Office 2011 for Mac when using our networked Konica-Minolta Bizhub C360. I realize this may no