Solved

Dynamically loading swfs no buttons

Posted on 2003-11-20
10
260 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
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
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…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

820 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