
Welcome Guest
|
|
|
#1
|
|||
|
|||
|
loading variables into movieclip
I wish to load a variable on the main timeline into a movie clip.
The variable is "n" I put n=5 on in the first frame of the main timeline What instruction do I need to put in the instance of the movieclip please? I have tried selecting the instance on the stage and inserting onClipEvent (load) {_root.n} into the "Actions-MovieClip" box. this is obviously wrong as it does not work. Any help would be mcuh appreciated. John |
|
#2
|
||||
|
||||
|
On the first frame of your movie clip's timeline put:
Actionscript:
this.n = _parent.n; trace (this.n);
__________________
Our greatest glory is not in never falling but in rising everytime we fall. - Confucius Blog | Shared Items |
|
#3
|
|||
|
|||
|
Hi
Thanks for that. However if I put say n=3 in the main timeline and then Actionscript:
this.n = _parent.n; in the movie clip timeline, I will get the same number appearing in each instance. I want a different number to appear in each instance, and so I assume that I cannot put an instruction in the timeline of the movie clip in the library as each instance used will have the same number. Somehow I need to insert an instruction in the instance of the clip so that each one can have a different number. I assume that I need to select an instance that I have dragged on stage and insert an instruction in the "Actions-Movie Clip" that appears. The problem is that I can't work out the instruction to use. Can youi help? Last edited by Scottae : 08-24-2005 at 03:36 PM |
|
#4
|
||||
|
||||
|
You could use the onClipEvent
Actionscript:
onClipEvent (load) {
this.n = _parent.n;
}But I like to steer away from using these type of events. You could also set the variable on the clip from the main timeline. Say on your first frame, you have a clip called my_mc. You can place this code on the first frame of the main timeline: Actionscript:
my_mc.n = this.n; I think this would be a better way. This keeps all your code in one place. So if you have to make changes, you don't have to click on every clip instance to do so. The onClipEvent makes finding code like a wild goose chase. The onClipEvent was necessary to use certain events back in Flash 5 (enterFrame, mouseDown...etc.) But it's not necessary if publishing to the Flash 6 player or better. But people still use it because they look at old tutorials that were made when Flash 5 was the latest and greatest.
__________________
Our greatest glory is not in never falling but in rising everytime we fall. - Confucius Blog | Shared Items |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Loading Variables Via Mysql > Php > Flash | xgermz | Flash 8 |
3 | 01-14-2007 08:33 AM |
| loading variables from txt | hisp | Flash 8 |
3 | 01-13-2007 05:09 PM |
| loading movieclip troubleshooting | Mikey Freedom | Newbies |
0 | 12-09-2005 11:45 AM |
| Loading variables | shaggy_LFC | Flash MX |
6 | 04-01-2004 04:35 AM |
| Loading variables into a loaded .swf??? | crucial | Flash 5 Actionscript |
3 | 03-16-2001 05:12 PM |




