A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: [F8] help targeting specific frame in an external flash swf

  1. #1
    Senior Member
    Join Date
    Dec 2007
    Posts
    121

    [F8] help targeting specific frame in an external flash swf

    Hi, here is my problem.

    I have a flash File. The main file.. Then, some external swf that loads in the mail file once user clicks on a button.

    I'm using MovieClipLoader to accomplish this. Till now its ok.

    Now, i have a button on the main flash file, i want it to load an external swf file but at an specific frame label.

    How do i do this? I'm really stuck on this ...

    Please help if you can! Thanks

  2. #2
    Senior Member
    Join Date
    Dec 2007
    Posts
    121
    I tried using anchor, but with no luck.,

    One question, can this work locally, or it works only on server?

  3. #3
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    you can use your clipLoader() instance to do tis by using the onLoadInit();

    say you have a empty/blank movieClip (ie: containerClip) in your MAIN.swf that when you click a button loads an external.swf into that target.

    on your onLoadInit() callBack..
    you can just tell it to:

    function onLoadInit(mc){
    mc.gotoAndStop("framelabel");
    }

    outside of the onLoadInit() function you would have to use the containerClip's instance name in the path

    containerClip.gotoAndStop("framelabel");

  4. #4
    Senior Member
    Join Date
    Dec 2007
    Posts
    121
    in my code, i already have an onLoadInit like this

    mcLL.onLoadInit = function(){
    some codes there
    }


    can i add another onLoadInit or should be in the same function? Do you have an example plz?

  5. #5
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    not a new one.. if that IS in fact the clipLoader instance you are using to load you external.swf

    just add the line there.. once the .swf is completely loaded.. the onLoadInit() is executed automatically (as you should know)..

    so as long as you put the frame number/label in there to jump to..it should work.

  6. #6
    Senior Member
    Join Date
    Dec 2007
    Posts
    121
    Ok, so it wont affect the other swf file that is being loaded also?

  7. #7
    Senior Member
    Join Date
    Dec 2007
    Posts
    121
    here is the code i have so far, what should i add?


    var mcl:MovieClipLoader = new MovieClipLoader();
    var mclL:Object = new Object();

    mclL.onLoadProgress = function(target,loaded,total){
    loader_mc.percent.text = Math.round((loaded/total)*100) + "%";
    }

    mclL.onLoadInit = function(){
    loader_mc._visible = false;
    }

    mcl.addListener(mclL);

    mcl.loadClip("home.swf",holder_mc);


    learn_btn.onRelease = function () {
    mcl.loadClip("services.swf",holder_mc);
    }

    i want the services.swf to go to a specific frame.. I've tried many things with no luck

  8. #8
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    what other .swf that is being loaded?

    you can only load one .swf a time with 1 instance of a clipLoader

    in this case you are loading services.swf into the holder_mc.

    you can try this:

    mclL.onLoadInit = function(){
    loader_mc._visible = false;
    holder_mc.gotoAndStop(3); //or whatever frame it is you want to go to
    }

    or

    mclL.onLoadInit = function(target){
    loader_mc._visible = false;
    target.gotoAndStop(3); //or whatever frame it is you want to go to
    }

  9. #9
    Senior Member
    Join Date
    Dec 2007
    Posts
    121
    oh, lol.. i mean, wont it affect the other swf which i wanna load.. bad explanation from me. sorry.

    Should i also add this

    learn_btn.onRelease = function () {
    mcl.loadClip("services.swf",holder_mc);
    }

    Sorry to bug, but its the first time im doing something like this..

  10. #10
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    I guess Im not following on your loading other .swf comment/question..

    but here is an example..it does get much easier to follow than this Im afraid.

    (see attached)
    Attached Files Attached Files

  11. #11
    Senior Member
    Join Date
    Dec 2007
    Posts
    121
    well it does work but with some problem

    on the main swf, i have two button which actualy load one swf, on the swf being loaded, their are four menu, first button is services_btn which should load the swf.. second button is learn_btn which should load the same swf but at a specific frame.

    when i use your code, the two button brings me to the same frame label and also, the preloader doesn't work for that swf.

    Maybe i should be using an IF statement but i have no clue how!

  12. #12
    Senior Member
    Join Date
    Dec 2007
    Posts
    121
    Ok i got the preloader to show up..

    but now, the problem is with the two button.

    learn_btn should be the only one to target that specific frame in the external swf.

    services_btn should load the same external swf normaly, which mean at the first frame.

    How do i overcome this.. :sigh:

  13. #13
    Senior Member
    Join Date
    Dec 2007
    Posts
    121
    huh no one who can help me overcome this?

  14. #14
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    you can either:

    use a different clipLoader() instance.. or set the frame number to be a variable..that is set on button click..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center