Solved

Dynamically loading swfs no buttons

Posted on 2003-11-20
10
230 Views
Last Modified: 2010-04-03
Sure it works with a button but...

Is it possible to have a dynamically loaded swf navigate to a frame on the main timeline? The swfs have an accompanying narration track.

I have attempted loading the swfs and  sound files both dynamically wihtin the main timeline. I had limited success using "onSoundComplete" but it often cuts off the swf animation when it jumps to the new frame. So ideally I would like the swf and narration to complete then go to the desired frame.
0
Comment
Question by:doitinhouse
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 1

Expert Comment

by:text_problems
Comment Utility
not sure exactly what you mean.

to target the root you can just put an action on the last frame of the loaded swf:

_root.gotoAndPlay("your_frame_label");
0
 

Author Comment

by:doitinhouse
Comment Utility
Thanks for your response. I tried that before posting but I may have been doing something wrong. I'll give it another shot.

I've been using the Flash series since Flash 4 and this past week purchased Flash MX 2004 Pro.

I was looking at a feature in Flash MX 2004 pro that sounds helpful but I can't quite figure it out. Maybe I'm sniffing around the wrong tree..

     this._lockroot = true

If I meet with success I'll let you know.
0
 
LVL 1

Expert Comment

by:text_problems
Comment Utility
I'm afraiid I'm only on mx - but the code I posted will do it. Once a swf is loaded to another movie it is treated as part of that movie.

If you load my.swf to _root.my_holder, all code in my.swf will work as if it were on the timeline of _root.my_holder.
0
 
LVL 27

Expert Comment

by:negatyve
Comment Utility
this._lockroot = true

if you write this line in the first frame of your external movie, when you load it in the main movie, on a level or in a movieclip, if you use "_root" inside it, it will always be pointing to the external movie "_root", and not to the main movie "_root" as it used to do in the past (creating path issue).
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:doitinhouse
Comment Utility
the problem seems to be that no matter what command I put into the external swf
it only pertains to the root timeline of the that external swf.

here's what's going on:

I have a movieclip  "myclip"

It's on the main timeline.
In the first frame of  "myclip"
   loadMovie("swfs/tour1.swf",2)

It loads it plays.

In the last frame of the loaded "tour1.swf "I have tried the following while troubleshooting with no luck

_root.gotoAndPlay("tour2");

root.gotoAndPlay("tour2");

gotoAndPlay("tour2"); (if "tour1.swf" has frame labeled"tour2" it does navigate within the "tour1.swf" timeline)

It never seems to send the command
(and yes there is a "tour2" label further down on the main timeline )

Im sure it's a path issue but it's late my head hurts. Need a break. If I ever figure it out I will try to let you all know where I went astray. Hopefully we can keep some future Flasher out of a similar mess.

Thanks for all responses.




0
 
LVL 1

Expert Comment

by:text_problems
Comment Utility
does your external swf definitely load?
is there something wrong with the timeline of your external clip to stop it getting to the last frame?
0
 
LVL 27

Expert Comment

by:negatyve
Comment Utility
1. it's not:

loadMovie("swfs/tour1.swf",2)

but

this.loadMovie("swfs/tour1.swf")

instead

2.

try this too:

this._parent.gotoAndPlay("tour2");
0
 

Author Comment

by:doitinhouse
Comment Utility
This works. The original logic was correct and a simple typ9o was preventing my call from the external swf from hitting the root. One of those typos that come from sitting in front of Flsh for too long. Frustrating. Thanks for all posts, walking thru it helped find the issue.

Here's what I ended up with.

--- for actionscript for emtpy movieclip in main timeline:

yourmovieclipinstancename.loadMovie("swfs/tour1.swf",2)
firstSound=new Sound()
firstSound.loadSound("swfs/vo/1opener.mp3",true)
stop();
//firstSound.onSoundComplete = function() {
//gotoandplay("tour2");
//;
//}
//firstSound.start();

----note: that the commented out/// section would use the external sound file end to trigger to the frame label "tour2" in the main timeline
---- firstSound function loads external sound file -- narration in my case-- "true" sets it to stream.

--actionscript in the last frame of external swf "tour1.swf"

 _root.goToAndPlay("tour2")

Thanks again to all.



0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
Comment Utility
PAQed, with points refunded (500)

Computer101
E-E Admin
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now