Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flash General Questions > Other Flash General Questions

Reply
 
Thread Tools Rate Thread Display Modes
Old 09-13-2002, 08:32 PM   #1
MadWilson
Registered User
 
Join Date: Aug 2002
Location: Omaha
Posts: 82
Default how to make a variable = several MC's

Is ther a way to make a Variable calld "test" and every dragable MC That i make = that Variable

Thanks
MadWilson is offline   Reply With Quote
Old 09-13-2002, 09:33 PM   #2
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

not sure i understand...
a movieclip is an object
a variable "test" is a string
you cant make a movieclip a string.

you can set a variable inside your mc to equal the variable on the main timeline, if thats what you want to do.

??? post more info.
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 09-15-2002, 05:21 PM   #3
MadWilson
Registered User
 
Join Date: Aug 2002
Location: Omaha
Posts: 82
Default

I didn't mean for the Test to be taken as a string so here is my code

Test = MyMovieClip;

and then make a second MC have the same variable but act as its own MC.

Thanks
MadWilson is offline   Reply With Quote
Old 09-15-2002, 07:34 PM   #4
flx
Confused? I am....
 
flx's Avatar
 
Join Date: Aug 2002
Location: EaRTH
Posts: 90
Default Hmmm...

Still a bit puzzled.. but then i'm just a newbie so i'm always confused..

Perhaps if you explain the reason for the variable "test" it may make the answer to ur problem a lil clearer.

Hope to hear from you soon...
flx is offline   Reply With Quote
Old 09-15-2002, 08:18 PM   #5
MadWilson
Registered User
 
Join Date: Aug 2002
Location: Omaha
Posts: 82
Default Re: Hmmm...

The reason for make every MC that you can drag = to The variable Test so that when you go to drag the MC your constraning actons will work for every MC that you have on the screan.

The constraning box is not found in side the button it is on the main time line and it is looking for a sertin variable the variable is "Test". with out this "Test" you can drag the MC all over the screan and i don't won't that.

thanks
MadWilson is offline   Reply With Quote
Old 09-16-2002, 03:24 AM   #6
Odoacer
Registered User
 
Join Date: Apr 2002
Location: irvine, ca
Posts: 26
Send a message via AIM to Odoacer
Default

well im not sure if this is what you want but you can give a MC a name and dictate the MC's actions through that name.

You can make it so that if your MC affects your variable "test" - say, changing it from "true" to "false" or whatever. And when "test"'s T/F state changes, you can impose movement restrictions on your MC.

Two MC's cant have the same name but you can control both of them through one function.

I hope thats what you were going for.
Odoacer is offline   Reply With Quote
Old 09-16-2002, 08:54 PM   #7
flx
Confused? I am....
 
flx's Avatar
 
Join Date: Aug 2002
Location: EaRTH
Posts: 90
Question Ahh.. i think i know..

If my understanding is correct the answer to your problem lies within the first 'reply'.
As tg said...
Quote:
tg - you can set a variable inside your mc to equal the variable on the main timeline
My flash isn't working properly at the moment so i cant check the exact code.. but the basics of what you'll have is:

On the main time line
ActionScript Code:
// how far left you want the MCs to go Left = (input number here) // How far right you want the MCs to go Right = (input number here) // Top value - u get the idea Top = (input number here) // Bottom value Bottom = number

The code for the button within the MCs

ActionScript Code:
on (press) { //left /right constraints  if (this._x <= _root.Left and this._x >= _root.Right) {     startDrag (this, true); // top/bottom constraints if (this._y <= _root.Top and this._x >= _root.Bottom) {     startDrag (this, true); } }

This code is made up off the top of my head.. it may work... but i doubt it will 100%

Basically though.. the limits are set by the variables in the timeline (Left,Right,Top,Bottom) and the code within each movie clip targets these variables and uses them. This method will allow you to simply copy and paste the code into the button of each MC and easily change the constraints for all the MCs by simply altering the variables in the timeline.

Hope this makes sense.. but above all... i hope it helps!

As mentioned before - i'm still relatively new to actionscripting (also confined to flash 5 actionscripting for the moment) so any experts plz do correct my errors.
flx is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

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

Forum Jump


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

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.