Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dynamically loading swfs no buttons

Posted on 2003-11-20
10
Medium Priority
?
271 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 1

Expert Comment

by:text_problems
ID: 9791562
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
ID: 9791898
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
ID: 9792003
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 27

Expert Comment

by:negatyve
ID: 9792246
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
 

Author Comment

by:doitinhouse
ID: 9793134
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
ID: 9795420
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
ID: 9795490
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
ID: 9796149
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
ID: 12186223
PAQed, with points refunded (500)

Computer101
E-E Admin
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

722 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