Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Dynamically loading swfs no buttons

Posted on 2003-11-20
10
Medium Priority
?
273 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
9 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
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. …
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
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…
Suggested Courses

783 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