A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: How to make a link in loaded SWF link to ITS main timeline

  1. #1
    Junior Member
    Join Date
    Dec 2001
    Location
    UK
    Posts
    17

    Question How to make an embedded SWF link to its main timeline from a movieclip

    I am literally at the end of my wick with this one!

    -----

    Here's the skinny, so to speak:

    home.swf
    products.swf
    button line mc
    animated button mc

    When someone clicks on animated button mc a swf needs to load into container mc which sits on the main products.swf timeline.

    Flash CS4 - Actionscript 2

    -----

    Now the full blurb:

    I use Flash a bit for animation and not a lot with actionscript, although I am learning. I use AS2 and am currently producing a website. I'm using it as a learning curve really, but my normal searching of the forums and internet isn't helping with this one!

    I have hit a snag with loaded swf's.

    Here's what I have: A main movie (home) which then loads in a products swf (products) and within that products page is a movieclip (button line mc) which contains the first line of buttons as they animate in (animated button mc). What I would like to happen is that when someone clicks on a button instance it loads an external swf onto the main products timeline, into an mc called container mc.

    What is currently happening when the button instance is clicked is nothing. I tried instead to make the button go to the main timeline on the products swf and play, then a loader component load the swf, but when I do this it goes back to the start of the home parent movie! I've tried the _lockroot thing, by putting it in the first frame on the loader, and I've tried adding _root.product.gotoandPlay to make it go to the products timeline and not the one products is sitting in, but it's not working!

    I'm getting in a right mess with it and have forgotten what the code was I originally wrote in for the button to load a swf into a targeted mc (I did it from a tutorial and have since replaced it with a goto and play element!)

    If anyone can offer any help or guidance I'd be very grateful!

    Also, if anyone can recommend a good place/book/site to learn actionscript for things like this, I'd be all ears! Thanks again.

    Adam
    Last edited by flashman_y3k; 12-17-2009 at 09:31 AM. Reason: Title change
    adamoliver.com

  2. #2
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    I've attached an example of what I think you need.

    "embed-embed.swf" has a movieclip called "loader" and a button that calls loader.loadMovie("embed.swf") to load "embed.swf" into loader.

    "embed.swf" has the same setup as embed-embed.swf, except instead it loads "embedAnim.swf" into its own "loader" movieclip.

    "embedAnim.swf" is just a little animation I did in a matter of seconds just for this example! =D (hooray for brush tool!)


    I've attached all 3 .swf and .fla files.

    Hope it helps!

    -Zippy Dee
    Attached Files Attached Files
    Z¡µµ¥ D££

    Soup In A Box

  3. #3
    Junior Member
    Join Date
    Dec 2001
    Location
    UK
    Posts
    17
    Thanks a lot for your time! So basically I need to make sure that lockroot script is on every loader movieclip, and the _root.loader.loadmovie bit added to the movieclip/button that is going to load it?

    I think I've got it...the only problem is this bloomin' website has got so complicated I don't know where to start with modifying it! I think I need some sort of plan to make it easier to work with.

    I'll let you know how I get on.
    adamoliver.com

  4. #4
    Junior Member
    Join Date
    Dec 2001
    Location
    UK
    Posts
    17
    I've just put the changes in and it all seems to be working! The only problem I had was in the last swf the buttons still wouldn't load the other swf's, I have no idea why as it was exactly the same set up as the others. I got round it by adding loader components at different parts of the timeline, then making the buttons go to those parts when clicked. I'm not sure if this has any negative effects, but seems ok so far.

    Thanks again.
    adamoliver.com

Tags for this Thread

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