PDA

View Full Version : linking between mc's


rubenv
12-07-2004, 09:29 PM
Hello,
I'm a newbie to Flash and stuck with the following problem. I think fo experts solving it will be a piece of cake.

I have a mc caalled: mc_content. This mc contains several mc's (mc1,mc2,mc3,mc4,mc5) all at hte same level.

How can I navigate (with gotoAndStop) from mc1 to mc3, etc.

Thanks for the help in advance,
Ruben

emergency_pants
12-07-2004, 09:37 PM
Hi Ruben, you've come to the right place :D

How are your clips laid out in the timeline of mc_content?

If they are all on a different frame, you can tell the playhead to gotoAndStop(frameNumber) or gotoAndStop("frameLabel");

e.g.

//frame script
button3.onRelease = function(){
mc_content.gotoAndStop(3);
}


or you can place the script straight onto the button

//script attached to button3
on(release){
_parent.mc_content.gotoAndStop(3);
}


I've attached a test movie which uses scripts attached to the buttons.

Hope that helps... if you need any more help, let us know :)

rubenv
12-08-2004, 09:32 AM
Hi Simon,

First of all: Thanks for spending some time into my problem.
But I think I have confused you a little bit (therefor I apologize.
You have placed the buttons on the main timeline, but I have to place them into mc1 or another mc#, because I want to nvigate from mc1 (or another mc#) to mc3 (or another mc#).

So the soultion you provided won't work, or didn't I understand you correctly...

You're gues that I have placed mc1, mc2, etc. in different frames in the mc_content is correct.

I would be very pleased if you could spend some more time into my problem to give me the solution.

Thanks in advance and cheers,
Ruben

emergency_pants
12-08-2004, 04:00 PM
Sorry about that, Ruben.

Could you clarify this for me? You want to duplicate all of those buttons and place a copy of them all inside every mc# movieClip?

Is there a specific reason why you need to do this? I ask because if you need to change a script on one of those buttons, you will need to go through all your clips and change the buttons scripts multiple times, which will become v annoying.

If the buttons are supposed to remain static in your movie, I advise you to have just one set of buttons (they could be placed inside their own movieClip, called "navButtons" or something) and place them inside mc_content, or on the _root of your movie, as in my previous example.

Anyway... I've attached an example which has the same buttons duplicated in every one of your mc# movieclips.

Some more advice... hope you don't mind and forgive me if you have already done so... but read the following topics in Flash Help:

"Dot Syntax"
"Absolute Paths"
"Relative Paths"
Everything under the search "target path"

This should help you ALOT in working out how to control movieClips from buttons and from other movieClips.

Hope that helps.

Ruben
12-08-2004, 04:06 PM
Whaha, I feel like I'm talking to the other half of my split personality :p

To clear things out:
1) There's one movieclip (mc_content) on the mainstage
2) In mc_content there are several movieclips (mc1, mc2, mc3, etc)
3) Every movieclip in mc_content is placed on a seperate frame

If the above is correct I guess by navigating you mean displaying the movieclips in mc_content...is this right?

:confused: - Ruben

EDIT: Damn! Emergency_pants posts WAY too quick ;)

rubenv
12-09-2004, 12:45 PM
Simon,
Thanks for the help and spending time into he problem.

The reason of the problem i: I'm making an glossery of terms in flash. The mc_content contains 26 frames (A thru Z) and each frame contains a mc with the list of words (in a listbox) and (if clicked) a description of the clicked term. Sometimes a term contains a "see also" link to another term. For example: the term car has a see also to Ford. In a sheme it looks like this:

main -> mc_content ->mc_A (this mc contains 78 frames with terms)
| ->mc_B (this mc contains 85 frames with terms)
|->mc_...

I don't know if I'm using the right method but I didn't find another solution (so far...) maybe you have another idea.

I will studythe help with the topics you gave earlier

Ruben,
I hope I have answered your question also with the above explanation.
And your gues is correct "by navigating is displaying...

Thanks to you all!!!!
Ruben

Hop to hear soon...

emergency_pants
12-09-2004, 02:42 PM
It looks like you have a massive lot of movieClips on your hands.

It will work though... and any method which works is fine. Nothing wrong with the way you want to do it at all.

However... you will be spending a lot of time duplicating movieclips and pasting text into fields... just the "A" words contains 78 movieClips? Wow... you'll be doing that until you're grey :p

If I were confronted with your project, I might think about placing all my data in one place and then send individual entries to just one movieClip. After all, the glossary entries all look the same, right? So why bother to duplicate it 400 times, one for each word? Why not take the data and send it to a single movieClip? :D

This can be done in several ways. you could enter all of your glossary into a txt file and load it in. Or even better, enter all your data into an XML file and load that into an XML Object in Flash.

Then use the data to populate a list component, which contains your words. When an item is clicked in the list component, the data is accessed again and the data for that word is extracted and placed into a text field.

If you haven't used Flash or XML much, it might sound fiddly, but once you know how, you'll see that it can save you ALOT of time on a project like this. it will also allow you to insert related glossary items in each entry... a little bit like a database.

If you want some help with that, let me know. I probably have some files here somewhere which I can send you, such as a sample XML file and a basic FLA file which loads the XML data and sends entries to a list component and text field in a movieClip.

rubenv
12-09-2004, 09:58 PM
Simon,
I was already thinking of doing it in XML and flash but the unknown of that was a litlle bit frightening me.

So if you can help me out with one or two examples I would be very pleased. After all if it saves a lot of work, I will be happy (I'm a little bit a lazy guy :D )

Thanks again for the advice and I can't wait to see the examples. I hop it won't cost you to much time to find the files!

Cheers,
Ruben

emergency_pants
12-10-2004, 01:49 AM
Hi there,

I have a set of files here which loads an xml glossary and shows glossary definitions when a word is selected.

I haven't got time to get the "related terms" function working because the glossary I have made previously does not have letter selections... so therefore the related terms function I had made previously won't work. Sorry, but I don't have time to work out how that can be solved right now... a post in the Actionscript 2.0 board, perhaps? :D

In a nutshell, there is an XML object created in the flash file. This is filled with data from the XML file. Pieces of the data are passed to an array and that array is used to fill the wordList when a letter is selected.

When a word is added to the word list, it not only sends the label to show in the list, but also the definition. You will see that each entry in the word list component has a "label" and "data". So the word list component now holds the label AND the definition! When a word is selected from the list, the data is read from this wordList component and placed into a textField.

So, as you can see the data is filtered and passed from one place to another as the user makes selections.

If you have any questions, shout.

You can find info in "array class" and "xml Class" and "list class" in the help files to help you understand the methods and the ways which the data is being passed around from place to place. :)

rubenv
12-10-2004, 11:28 PM
Simon,
Thanks for the help. I'implementing the whole thing right now!!

Cheers,
Ruben