Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

Closed Thread
Results 1 to 8 of 8

Thread: Pulling two dynamic xml picture gallery backgrounds at different times thru loadMovie

  1. #1

    Default RESOLVED - Pulling two dynamic xml picture gallery backgrounds at diff times

    Hey guys,
    I am a web developer but I am a beginner in flash. I have been trying to find a solution to my problem but I haven't had any luck. My problem is I need to load a different background (child) movie clip that would replace the default one when a button is pressed. I have two background movie clips that should be loaded one at a time.

    To summarize, the main file is sample.fla. This loads two background movie clips (bg_1.swf and bg_2.swf) through movieClipLoader.loadClip() method one at a time. It is supposed to swap the bg's depending on which section of the main timeline they are at (through the on release event of the buttons). The default bg is bg_1.swf which is the "nightlife bg". Clicking on "restaurant" loads the second bg (bg_2.swf "restaurant bg") on the same target so that should replace the first/default bg. The problem is it does not. Unloading works but reloading the same target with a different mc only makes it play the current/original background.

    I am really starting to get frustrated because it seems like a trivial thing to do. I am just starting to learn flash and I really like to get better at it. I am thinking maybe it is because of the way the background bg is coded that it is not meant to be loaded and reloaded (i did not code the bg's). If anyone could help in any way, it would be very much appreciated. If my technique is wrong and there is an easier way to achieve the bg swaps, please let me know. Thanks in advance!
    Last edited by rockjamesroll; 04-16-2008 at 08:29 PM. Reason: Resolved

  2. #2
    Join Date
    Aug 2007
    Location
    Germany
    Posts
    390

    Default

    hey,

    maybe you can post your code? We are not downloading stuff from other peoples....

    But it can't be a big problem... usually i do it the same way.

    Regards,
    A.
    hardware is the part of a computer which can be kicked

    Things that NTD thaught me:

    {An optimist sees the glass as half full. A pessimest sees the glass as half empty.
    A programmer sees the glass as twice the size it needs to be.}


    Please no questions via private and / or instant message!


  3. #3

    Default

    Thanks for the reply. I decided to link to the files since it is not a lot and i feel like the problem might be in the child movie clips but here is a chunk of my code:

    sample.fla (main movie that has 2 buttons: "nightlife" that should play bg_1.swf as the background and "restaurant" that should play bg_2.swf as the background):
    frame1:
    var bg_container:MovieClip = createEmptyMovieClip("bg_container", 0);
    bg_container._x = 0;
    bg_container._y = 85.5;
    var bcl:MovieClipLoader = new MovieClipLoader();
    var bclL:Object = new Object();
    bcl.addListener(bclL);
    bcl.loadClip("bg_1.swf","bg_container"); //bg_1.swf is the default BG

    restaurant button on release event:
    on (release) {
    //bcl.unloadClip("bg_container"); /*this one works and unloads the mc only if NOT followed by another load */
    bcl.loadClip("bg_2.swf","bg_container"); /*this one doesn't work. regardless if I unload first or not, it still plays the first bg set in the first frame (bg_1.swf)*/

    gotoAndPlay("restaurant");
    }


    Just really confused as to why it doesn't work. I read a bunch of posts in this forum and other forums that in theory, I shouldn't need to unload because loading in the same target should replace the original content.

    Thanks!

  4. #4

    Default

    Also, I have tried using loadMovie (with or without unloadMovie() first) and it does not work either.

  5. #5
    Join Date
    Feb 2008
    Posts
    570

    Default

    might be a target path issue with code posted on a button?
    try:
    _root.bcl.loadClip("bg_2.swf","bg_container");

    be sure that the instance name "bg_container" is still present on the timeline when the button is displayed.

    see if you can trace the "instance name" ? - should give you the level (i think?)
    Last edited by blitzzz; 04-14-2008 at 08:42 PM.

  6. #6
    Join Date
    Feb 2008
    Posts
    570

    Default

    my bad, that would be :
    on (release) {
    bcl.loadClip("bg_2.swf", "_root.bg_container");
    }

    with loadClip the brackets are (url:String, target:Object)

    should work.
    Last edited by blitzzz; 04-15-2008 at 06:32 AM.

  7. #7
    Join Date
    Feb 2008
    Posts
    570

  8. #8

    Default

    Hey, thanks for the replies, I appreciate it. You are right that the reason why the child movie clips are not loading and unloading correctly was because of targeting issues. Those child MC's wrongly target the parent. I have a lot to learn and you guys here and at actionscript.com have been helpful. Thanks again.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

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