LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 




ReplyREPLY THREAD
 
Thread Tools Display Modes
  #1  
Old 08-12-2005, 01:42 PM
john65432 john65432 is offline
Registered User
 
Join Date: Aug 2005
Posts: 7
Rep Power: 0
john65432 is on a distinguished road
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
Reply With Quote
  #2  
Old 08-12-2005, 11:08 PM
Scottae's Avatar
Scottae Scottae is offline
God Moderator
 
Join Date: Oct 2003
Location: United States
Posts: 6,532
Rep Power: 16
Scottae is on a distinguished road
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
Reply With Quote
  #3  
Old 08-13-2005, 09:19 AM
john65432 john65432 is offline
Registered User
 
Join Date: Aug 2005
Posts: 7
Rep Power: 0
john65432 is on a distinguished road
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
Reply With Quote
  #4  
Old 08-13-2005, 05:40 PM
Scottae's Avatar
Scottae Scottae is offline
God Moderator
 
Join Date: Oct 2003
Location: United States
Posts: 6,532
Rep Power: 16
Scottae is on a distinguished road
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
Reply With Quote


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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




All times are GMT. The time now is 09:38 PM.